Using a command in a codeblock

This forum is for posting of useful information
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4300
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Using a command in a codeblock

#1 Post 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)}
The eXpress train is coming - and it has more cars.

Post Reply