WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Determine Which Dialog Control Previously Had Focus


#DEFINESUBROUTINE trackfocus(DialogHandle, EventCode, ControlNum, Res4, Res5)
switch( EventCode)

case 0
DialogProcOptions(DialogHandle,1,1) ;enable TIMER with a milisecond count
DialogProcOptions(DialogHandle,2,1) ;enable BUTTONS
prevfocus = 0
break

case 1
focusctrl = DialogControlState(DialogHandle,0,5,0) ; gets the current control number that has focus - a zero means no control has focus 
if focusctrl == prevfocus then break
DialogControlSet(DialogHandle,8,4,prevfocus)
DialogControlSet(DialogHandle,9,4,focusctrl)
prevfocus = focusctrl
return -2


case 2
if ControlNum == 6 then return -2 ; Don't termnate the dialog

if ControlNum == 17
Display(2,"","Goodbye World")
return -1
endif
endswitch

return -1
#ENDSUBROUTINE


MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`WIL Dialog 1`
MyDialogX=539
MyDialogY=-30
MyDialogWidth=112
MyDialogHeight=137
MyDialogNumControls=017
MyDialogProcedure=`trackfocus`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`009,011,036,012,EDITBOX,MyVariable1,"Edit 1",DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`009,027,036,012,EDITBOX,MyVariable2,"Edit 2",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`009,043,036,036,ITEMBOX,MyVariable3,DEFAULT,DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`063,011,044,012,CHECKBOX,MyVariable4,"Check 1",1,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog005=`063,027,044,012,CHECKBOX,MyVariable5,"Check 2",1,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog006=`065,051,036,012,PUSHBUTTON,DEFAULT,"Dummy",1,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog007=`007,097,076,012,STATICTEXT,DEFAULT,"Control with PREVIOUS focus:",DEFAULT,7,1026,"Microsoft Sans Serif|5632|40|34","0|0|0",DEFAULT`
MyDialog008=`085,095,016,012,VARYTEXT,MyVariable6,"Vary 1",DEFAULT,8,2,"Microsoft Sans Serif|10752|70|34","0|0|0",DEFAULT`
MyDialog009=`085,113,016,012,VARYTEXT,MyVariable7,"Vary 2",DEFAULT,9,DEFAULT,"Microsoft Sans Serif|10752|70|34","255|255|255",DEFAULT`
MyDialog010=`007,115,076,012,STATICTEXT,DEFAULT,"CURRENT focus:",DEFAULT,10,1024,"Microsoft Sans Serif|8192|70|34","255|255|255",DEFAULT`
MyDialog011=`003,011,006,012,STATICTEXT,DEFAULT,"1",DEFAULT,11,DEFAULT,"Microsoft Sans Serif|5632|70|34","255|255|255",DEFAULT`
MyDialog012=`003,027,006,012,STATICTEXT,DEFAULT,"2",DEFAULT,12,DEFAULT,"Microsoft Sans Serif|5632|70|34","255|255|255",DEFAULT`
MyDialog013=`003,043,006,012,STATICTEXT,DEFAULT,"3",DEFAULT,13,DEFAULT,"Microsoft Sans Serif|5632|70|34","255|255|255",DEFAULT`
MyDialog014=`057,011,006,012,STATICTEXT,DEFAULT,"4",DEFAULT,14,DEFAULT,"Microsoft Sans Serif|5632|70|34","255|255|255",DEFAULT`
MyDialog015=`057,027,006,012,STATICTEXT,DEFAULT,"5",DEFAULT,15,DEFAULT,"Microsoft Sans Serif|5632|70|34","255|255|255",DEFAULT`
MyDialog016=`057,051,006,012,STATICTEXT,DEFAULT,"6",DEFAULT,16,DEFAULT,"Microsoft Sans Serif|5632|70|34","255|255|255",DEFAULT`
MyDialog017=`065,067,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,17,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")

Article ID:   W15913
File Created: 2004:03:30:15:41:42
Last Updated: 2004:03:30:15:41:42