BoxOpen / BoxText + Winbatch Dialogs

Started by milesg, August 15, 2013, 09:40:14 AM

Previous topic - Next topic

milesg

I open a Winbatch dialog that uses a subroutine to process user responses to options / buttons in the dialog. One option requires me to open a windows box and display messages to the user while I am processing data (a sort of a progress bar via text messages and a counter). The BoxOpen function always opens the box in the background and the text in the box is never displayed but the title is. The text from the BoxText function is never displayed in this window either. If I use the same code to open the box prior to opening the Dialog window it works perfectly. Any ideas how I can resolve this problem?

Deana

The issue you are having is due to the fact that all running WIL scripts have a main window that is a 'box' running minimized on the Task bar. Any time you call a WIL dialog that dialog is created from this main box window. The BoxOpen box *is* the Winbatch main window. The dialog will always appear on top of it.

One option is to make the box larger than your WIL dialog. BoxesUp allows to your specify the size of your box. Then you will need to make sure that the text you want displayed in your box is written to the area of the box, that is not covered by the dialog. The WinBatch Setup.exe uses this method when installing WinBatch.

Another option is to create a Dynamic Dialog with a Dialog Callback Procedure and a VARYTEXT control. This VARYTEXT control can be dynamically updated  in the background. Reference: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+Tutorials+All~about~Dynamic~Dialogs~6.2.txt

And last but not least you can spawn a new script to display your box: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Boxes~Functions+Dialog~with~Box~Functions.txt

The option you choose depends on the underlying needs of the script.
Deana F.
Technical Support
Wilson WindowWare Inc.

milesg

I tried the resize option (BoxesUp) but the text from the BoxText function is never displayed in the window only the Box title, what is up with that?
Thanks

Deana

WinBatch offers two types of Box Functions.


  • Generic Box Functions: BoxOpen, BoxShut, BoxText and BoxTitle
  • Graphical Box Functions: All other Box functions.


You will need to use the graphical box functions to accomplish this. There are tons of Box function examples in the WinBatch.chm help file.

When using BoxDrawText make sure to specify box coordinates that display outside of your WIL Dialog.


Here is a simplified code sample that should get you started:

Code (winbatch) Select
BoxesUp("0,0,1000,1000", @NORMAL)
BoxDrawText(1, "0,100,1000,200", "WinBatch Box Example - BoxDrawText ",@TRUE, 1)
BoxCaption(1, "WinBatch BoxDrawText Example")

ScreenWidth = WinMetrics(0)/WinMetrics(-6) ;Determine screen width in dialog units
ScreenHeight = WinMetrics(1)/WinMetrics(-5) ;Determine screen height in dialog units

MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`WIL Dialog 1`
;This information can be used for calculations as follows:       
MyDialogWidth = ScreenWidth*0.663 ;Make a dialog 2/3 width of screen
MyDialogHeight = ScreenHeight*0.5  ;Make a dialog 1/2 height of screen
MyDialogX=(ScreenWidth-MyDialogHeight) /2 ;Determine X co-ordinate for a dialog to be centered
MyDialogy=(ScreenHeight-MyDialogHeight)/2;Determine Y co-ordinate for a dialog to be centered
MyDialogNumControls=002
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`089,095,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`157,095,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")




Reference: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+Tutorials+Screen~Coordinates~Explained.txt
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

Here is a little more dolled up example:

Code (winbatch) Select
BLACK="0,0,0"
WHITE="255,255,255"
RED="255,0,0"
GREEN="0,255,0"
DKGRAY="128,128,128"
GRAY="192,192,192"
DKRED="128,0,0"
DKGREEN="0,128,0"
BLUE="0,0,255"
PURPLE="255,0,255"
YELLOW="255,255,0"
CYAN="0,255,255"
DKBLUE="0,0,128"
DKPURPLE="128,0,128"
DKYELLOW="128,128,0"
DKCYAN="0,128,128"

boxid = 1

BoxesUp("0,0,1000,1000", @NORMAL)
BoxColor(boxid, BLACK, 7 )
BoxDrawRect(boxid, "0,0,1000,1000", 2 )
BoxTextColor(boxid, WHITE)
BoxDrawText(1, "0,100,1000,200", "WinBatch Box Text",@FALSE, 1)
BoxCaption(boxid, "WinBatch Box")
ScreenWidth = WinMetrics(0)/WinMetrics(-6) ;Determine screen width in dialog units
ScreenHeight = WinMetrics(1)/WinMetrics(-5) ;Determine screen height in dialog units
MyDialogFormat=`WWWDLGED,6.2`
MyDialogCaption=`WIL Dialog`
;This information can be used for calculations as follows:       
MyDialogWidth = ScreenWidth*0.663 ;Make a dialog 2/3 width of screen
MyDialogHeight = ScreenHeight*0.5  ;Make a dialog 1/2 height of screen
MyDialogX=(ScreenWidth-MyDialogHeight) /2 ;Determine X co-ordinate for a dialog to be centered
MyDialogy=(ScreenHeight-MyDialogHeight)/2;Determine Y co-ordinate for a dialog to be centered
MyDialogNumControls=002
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,192|192|192`
MyDialogConfig=0
MyDialog001=`235,213,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`359,215,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("MyDialog")
EXIT
Deana F.
Technical Support
Wilson WindowWare Inc.