Hi,
I hope, I have almost end with headaches. :)
MyDialogFormat=`WWWDLGED,6.2`
;To keep the window at top
IntControl(54,"",1,0,0)
;Where is running the script? Param1 is a text file containing various informations to run properly that script
Str_wbtdir = DirScript():param1
;Str_MessageFile="C:\Program Files\Organisation\InstTrousses\Trousses\Test1.0_Frv1\msg.txt"
handle=fileopen(Str_wbtdir,"READ")
Count=0
While @True
Line=FileRead(handle)
if Line =="*EOF*"
Break
Else
Count=count+1
Endif
If Count== 1
Str_MessageP=Line
Endif
If Count== 2
Str_MessageSec=Line
Endif
If Count== 3
Str_MessageEntete=Line
Endif
EndWhile
FileClose(Handle)
MyDialogCaption=Str_MessageEntete
;MyDialogX=002
;MyDialogY=1000
;http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Dialog~Editor/Dialog~Editor~version~6.X+Center~dialog~for~any~screen~resolution.txt
MyDialogX=9999
MyDialogY=9999
MyDialogWidth=438
MyDialogHeight=136
MyDialogNumControls=004
MyDialogProcedure=`DEFAULT`
MyDialogFont=`Microsoft Sans Serif|9728|70|34`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,255|255|255`
MyDialogConfig=0
MyDialog001=`193,117,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`003,009,414,060,STATICTEXT,"StaticText_2",DEFAULT,%Str_MessageP%,DEFAULT,30,DEFAULT,"Microsoft Sans Serif|8192|70|34",DEFAULT,"255|255|255"`
MyDialog003=`005,101,410,012,STATICTEXT,"StaticText_4",DEFAULT,"________________________________________________________________________________________",DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`077,077,278,024,STATICTEXT,"StaticText_5",DEFAULT,"%Str_MessageSec%",DEFAULT,50,@csCenter,"Microsoft Sans Serif|8192|70|34","255|0|0","255|255|255"`
;MyDialog005=`5,5,5,5,MULTILINEBOX,Hidden,"",DEFAULT,1,0,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("MyDialog")
1. Is it a way to move tha caption at the top on the center of the top? Actually, it is always at the top left...
2. I would like to remove the focus on the OK button. I don't want my customers to presse a key on the keyboard and then pressing by mistakes the OK button.
a. Option A:
Change this value to MyDialogNumControls=005
and add this: MyDialog005=`5,5,5,5,MULTILINEBOX,Hidden,"",DEFAULT,1,0,DEFAULT,DEFAULT,DEFAULT`
But I get an error 3946.
b. Option B:
May be on click opening a second window asking "Click OK a second time to confirm" But I don't know how handlng it.
Any help will be appreciate.
It is sad to see Winbatch being retire next year...
Thanks,
Quote from: siocnarf on November 26, 2016, 11:52:30 AM
Hi,
I hope, I have almost end with headaches. :)
MyDialogFormat=`WWWDLGED,6.2`
;To keep the window at top
IntControl(54,"",1,0,0)
;Where is running the script? Param1 is a text file containing various informations to run properly that script
Str_wbtdir = DirScript():param1
;Str_MessageFile="C:\Program Files\Organisation\InstTrousses\Trousses\Test1.0_Frv1\msg.txt"
handle=fileopen(Str_wbtdir,"READ")
Count=0
While @True
Line=FileRead(handle)
if Line =="*EOF*"
Break
Else
Count=count+1
Endif
If Count== 1
Str_MessageP=Line
Endif
If Count== 2
Str_MessageSec=Line
Endif
If Count== 3
Str_MessageEntete=Line
Endif
EndWhile
FileClose(Handle)
MyDialogCaption=Str_MessageEntete
;MyDialogX=002
;MyDialogY=1000
;http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Dialog~Editor/Dialog~Editor~version~6.X+Center~dialog~for~any~screen~resolution.txt
MyDialogX=9999
MyDialogY=9999
MyDialogWidth=438
MyDialogHeight=136
MyDialogNumControls=004
MyDialogProcedure=`DEFAULT`
MyDialogFont=`Microsoft Sans Serif|9728|70|34`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,255|255|255`
MyDialogConfig=0
MyDialog001=`193,117,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`003,009,414,060,STATICTEXT,"StaticText_2",DEFAULT,%Str_MessageP%,DEFAULT,30,DEFAULT,"Microsoft Sans Serif|8192|70|34",DEFAULT,"255|255|255"`
MyDialog003=`005,101,410,012,STATICTEXT,"StaticText_4",DEFAULT,"________________________________________________________________________________________",DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`077,077,278,024,STATICTEXT,"StaticText_5",DEFAULT,"%Str_MessageSec%",DEFAULT,50,@csCenter,"Microsoft Sans Serif|8192|70|34","255|0|0","255|255|255"`
;MyDialog005=`5,5,5,5,MULTILINEBOX,Hidden,"",DEFAULT,1,0,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("MyDialog")
1. Is it a way to move tha caption at the top on the center of the top? Actually, it is always at the top left...
Win32 dialog title bars are controlled by the operating system. This is actually an advantage should a script become hung but it does limit what you can do with them. It is theoretically possible to center the text using some left side padding spaces or tabs by calling a few text extend Win32 APIs from the initialization event of a user defined dialog callback routine but it doesn't seem worth the trouble. While centered title bar text may be more common on Android or even Window Universal Platform applications, it really isn't something seen that often in regular Windows desktop applications.
Quote
2. I would like to remove the focus on the OK button. I don't want my customers to presse a key on the keyboard and then pressing by mistakes the OK button.
a. Option A:
Change this value to MyDialogNumControls=005
and add this: MyDialog005=`5,5,5,5,MULTILINEBOX,Hidden,"",DEFAULT,1,0,DEFAULT,DEFAULT,DEFAULT`
But I get an error 3946.
I know that the French help files are very outdated. So if your English skills are up to the task (I admire the bilingual), it is highly recommended that you spend some time learning dialog templates and other aspects of WinBatch dialogs in the English version of the help file. And for what it is worth, an invisible control will not accept user input when displayed in a WinBatch dialog.
Quote
b. Option B:
May be on click opening a second window asking "Click OK a second time to confirm" But I don't know how handlng it.
You can either use a user defined dialog callback routine to call a Pause or AskYesNo message box when the button click occurs or check the return value of the Dialog function. If the value returned is the value specified for the OK button, you can call the Pause or AskYesNo function. Based on the user's selection you can redisplay the dialog.
Quote
Any help will be appreciate.
It is sad to see Winbatch being retire next year...
Wilson WindowWare is dissolving as a corporation. The fate of WinBatch is not necessarily tied to the fate of the corporation.
A simplistic example of prompting before exiting a dialog:
;; User defined dialog callback subroutine.
#DefineSubroutine FooBar(Foo_Handle,Foo_Event,Foo_Name,Foo_EventInfo,Foo_ChangeInfo)
switch Foo_Event ; Switch based on Dialog Message type
case @deInit ; Standard Initialization message
DialogProcOptions(Foo_Handle,@dePbPush,@TRUE)
return(@retDefault)
case @dePbPush
if Foo_Name == "PushButton_OK" ; OK
nAnswer = AskYesNo(FooCaption, "Exit main dialog?")
If nAnswer == @YES then break
:cancel
return @retNoExit
endif
endswitch ; Foo_Event
return(@retDefault)
#EndSubroutine ; End of Dialog Callback FooCallbackProc
FooFormat=`WWWDLGED,6.2`
FooCaption=`Dumb Example`
FooX=860
FooY=075
FooWidth=179
FooHeight=084
FooNumControls=002
FooProcedure=`FooBar`
FooFont=`DEFAULT`
FooTextColor=`DEFAULT`
FooBackground=`DEFAULT,DEFAULT`
FooConfig=0
Foo001=`014,065,033,011,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
Foo002=`129,065,033,011,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("Foo")