Page 1 of 1

Using a command in a codeblock

Posted: Sun Oct 25, 2015 12:06 pm
by rdonnay
#xtranslate allow you to create commands that can be used in code blocks.
You must place the command in parenthesis.

Example:

Code: Select all

#include "dcdialog.CH"

#xtranslate MESSAGE <x> [<p: PROPERCASE>] =>  XMessage(<x>,<.p.>)

FUNCTION Main()

LOCAL GetList[0]

@ 0,0 DCPUSHBUTTON CAPTION 'Send Message' SIZE 20,1.2 ;
      ACTION {||(MESSAGE "this is a message to roger" PROPERCASE)}

DCREAD GUI FIT TITLE 'Code block test'

RETURN nil

* -----------

PROC appsys ; RETURN

* -----------

FUNCTION XMessage(cMsg,lProper)

IF lProper
  cMsg := DC_CapFirst(cMsg)
ENDIF

MsgBox(cMsg)

RETURN nil
This also works the the WTF debugging command:

Code: Select all

bBlock := {|a,b,c,d,e|(WTF a,b,c,d,e)}