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

Boxes Functions
plus
plus

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

Dialog with Box Functions


Question:

I have a dialog with a "Help" button. When pushed, the callback procedure does a "BoxesUp" to create a window with some help text in it. The Help box appears behind the dialog box, and won't come to the front even when I click it.

Is there a way to make the "BoxesUp" box come to the front?

Example...

;---------------------------------------
#DefineFunction HelpScreen()
BoxesUp("80,80,840,700",@NORMAL)
BoxCaption(1,"Help")
BoxTextFont(1,"",42,40,1|48);
BoxDrawText(1,"20,10,1000,1000","A bunch of helpful text goes here",@TRUE,0)
BoxButtonDraw(1,1,"Close","20,900,150,980")
BoxButtonWait()
BoxDestroy(1)
return
#EndFunction

#DefineFunction DataEntryCallback(deCallbackHandle,deCallbackEvent,deCallbackControl,rsvd1,rsvd2)
switch deCallbackEvent
case 0; 
DialogProcOptions(deCallbackHandle,2,@TRUE) 
return(-1)
case 2
switch deCallbackControl
case 001
HelpScreen()
return(-2)
endswitch 
endswitch 
return(-1) 
#EndFunction 

DataEntryFormat=`WWWDLGED,6.1`
DataEntryCaption=`Example`
DataEntryX=080
DataEntryY=055
DataEntryWidth=120
DataEntryHeight=120
DataEntryNumControls=002
DataEntryProcedure=`DataEntryCallback`
DataEntryFont=`DEFAULT`
DataEntryTextColor=`DEFAULT`
DataEntryBackground=`DEFAULT,DEFAULT`
DataEntryConfig=0
DataEntry001=`20,20,036,012,PUSHBUTTON,DEFAULT,"Help",1,11,0,DEFAULT,DEFAULT,DEFAULT`
DataEntry002=`20,40,036,012,PUSHBUTTON,DEFAULT,"Cancel",2,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
; Other fields omitted for this example
ButtonPushed=Dialog("DataEntry") 

Answer:

The dialog is derived from that very box, and thus the dialog always sits in front of the box.

Probably spawning a new script with a flag to display the desired information is what you want. Here's how you can get around the problem:

;-----------------------------------------
; if the "-SHOW-HELP-SCREEN" parameter is
; present, show the help, then exit.
;------------------------------------------
For X = 1 to Param0
   if Param%x% == "-SHOW-HELP-SCREEN"
     BoxesUp("120,80,840,700",@NORMAL)
     BoxCaption(1,"Help")
     BoxTextFont(1,"",42,40,1|48);
     BoxDrawText(1,"20,10,1000,1000","A bunch of helpful text goes here",@TRUE,0)
     BoxButtonDraw(1,1,"Close","20,900,150,980")
     BoxButtonWait()
     BoxDestroy(1)
     exit
   endif
Next

;------------------------------------------
; Callback function for dialog.  When
; the "help" button is pressed, run
; self with "-SHOW-HELP-SCREEN" param.
;------------------------------------------
#DefineFunction myFormCallback(myFormHandle,myFormEvent,myFormControl,rsvd1,rsvd2)
 switch myFormEvent
   case 0;
      DialogProcOptions(myFormHandle,2,@TRUE)
      return(-1)
   case 2
      switch myFormControl
         case 001
             Run(IntControl(1004,0,0,0,0),"-SHOW-HELP-SCREEN")
             return(-2)
      endswitch
 endswitch
 return(-1)
#EndFunction

;-------------------------------------------
;  The dialog
;-------------------------------------------
MyFormFormat=`WWWDLGED,6.1`
MyFormCaption=`Example`
MyFormX=020
MyFormY=055
MyFormWidth=80
MyFormHeight=80
MyFormNumControls=002
MyFormProcedure=`myFormCallback`
MyFormFont=`DEFAULT`
MyFormTextColor=`DEFAULT`
MyFormBackground=`DEFAULT,DEFAULT`
MyFormConfig=0
MyForm001=`20,20,036,012,PUSHBUTTON,DEFAULT,"Help",1,11,0,DEFAULT,DEFAULT,DEFAULT`
MyForm002=`20,40,036,012,PUSHBUTTON,DEFAULT,"Cancel",2,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("MyForm")



Article ID:   W15896
File Created: 2004:03:30:15:41:32
Last Updated: 2004:03:30:15:41:32