Skip to content

Instantly share code, notes, and snippets.

@MarkGoldberg
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkGoldberg/5b5efbbbfd7f70fa63fd to your computer and use it in GitHub Desktop.
Save MarkGoldberg/5b5efbbbfd7f70fa63fd to your computer and use it in GitHub Desktop.
Clarion - Test Notify
PROGRAM
gtNotification GROUP,TYPE
_Code UNSIGNED
CallerThread UNSIGNED
Param UNSIGNED !was Parameter
END
MAP
Main
Child(STRING xCallingThread)
END
INCLUDE('debuger.inc'),ONCE
dbg debuger
CODE
dbg.mg_init('TestNotify')
Main
Main PROCEDURE
Window WINDOW('Application'),AT(,,505,318),CENTER,MASK,SYSTEM,MAX,ICON('WAFRAME.ICO'),STATUS(-1,80,120,45),FONT('Microsoft Sans Serif',8,,FONT:regular),RESIZE
MENUBAR,USE(?Menubar)
ITEM('&Child'),USE(?Child)
END
END
CODE
OPEN(Window)
ACCEPT
dbg.PrintEvent('Frame')
CASE ACCEPTED()
OF ?Child; START(Child,,0{Prop:Thread})
END
CASE EVENT()
OF EVENT:Notify; DO OnNotify
END
END
OnNotify ROUTINE
DATA
Info LIKE(gtNotification)
CODE
NOTIFICATION( Info._Code, Info.CallerThread, Info.Param ) !<-- sets INFO 3 parameters
MESSAGE('Notifcation Received: Code['& Info._Code &'] FromThread['& Info.CallerThread &'] Param['& Info.Param &']')
Child PROCEDURE(STRING xCallingThread)
Text1 STRING(42)
STRING1 STRING(20)
W WINDOW,AT(,,120,105),FONT('MS Sans Serif',8,,FONT:regular),COLOR(0B7FFFFH),CENTER,NOFRAME
BOX,AT(0,0,120,18),USE(?Box:Title),FILL(0BCF9FAH)
BUTTON('+'),AT(3,1,12,12),USE(?Button:New),SKIP,FLAT,FONT(,,COLOR:Silver,,CHARSET:ANSI)
BUTTON('x'),AT(105,1,12,12),USE(?Button:Delete),SKIP,FLAT,FONT(,,COLOR:Silver,,CHARSET:ANSI)
BOX,AT(0,0),USE(?Box:Borders),FULL,COLOR(COLOR:Silver)
TEXT,AT(3,19,114,83),USE(Text1),FLAT,VSCROLL,TRN
STRING(@s20),AT(16,4,88,10),USE(String1),TRN
REGION,AT(0,0),USE(?Region:Main),IMM,FULL
END
CODE
OPEN(W)
ACCEPT
dbg.PrintEvent('Child')
CASE ACCEPTED()
OF ?Button:Delete; BREAK
END
END
NOTIFY( 42, xCallingThread, THREAD())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment