Hi,
I opening dialog inside an existing dialog. I am using Dialog1X=-01 Dialog1Y=-01 to poison the dialog in the middle. When i open the second dialog inside the first one it is position in the upper left corner instead of the center of the screen. It does not relate to the actual screen. Can i change that?
Thanks
Use -1 for x and y in the second dialog if you want it to always appear in the center of the screen. If you want the second dialog to appear in some position relative to the current position of the first dialog then query the position of the first dialog and adjust the position of the second dialog accordingly.
One approach to positioning the second dialog relative to the first involves using the WinPlace and WinPosition functions.
Here is a very crude example of relative positioning. These is not the only way to accomplish the task:
; Inner UDS
#DefineSubroutine InnerCallbackProc(Inner_Handle,Inner_Message,Inner_Name,Inner_EventInfo,Inner_ChangeInfo)
if Inner_Message == @deInit ; Standard Initialization message
strPosition = WinPosition(OuterCaption)
nX = ItemExtract(1,strPosition,',') + 50 ; Move right 50.
nY = ItemExtract(2,strPosition,',') + 40 ; Move down 40.
WinPlace(nX, nY, @NORESIZE, @NORESIZE, InnerCaption )
endif
return @retDefault
#EndSubroutine
InnerFormat=`WWWDLGED,6.2`
InnerCaption=`Inter Test`
InnerX=200
InnerY=200
InnerWidth=128
InnerHeight=084
InnerNumControls=003
InnerProcedure=`InnerCallbackProc`
InnerFont=`DEFAULT`
InnerTextColor=`DEFAULT`
InnerBackground=`DEFAULT,DEFAULT`
InnerConfig=2
Inner001=`025,066,030,011,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
Inner002=`068,066,033,011,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Inner003=`009,022,108,033,STATICTEXT,"StaticText_1",DEFAULT,"Hello World",DEFAULT,30,DEFAULT,"Microsoft Sans Serif|8192|40|34",DEFAULT,DEFAULT`
ButtonPushed=Dialog("Inner",0) ; WinBatch will not display this dialog.
;; Dummy data
mlVariable1 = ''
for x = 0 to 24
mlVariable1 := x:@CRLF
next
; Outer UDS
#DefineSubroutine OuterCallbackProc(Outer_Handle,Outer_Message,Outer_Name,Outer_EventInfo,Outer_ChangeInfo)
switch Outer_Message
case @deInit
DialogProcOptions(Outer_Handle,@dePbPush,@TRUE)
return(@retDefault)
case @dePbPush
if Outer_Name == "PushButton_OK"
Dialog("Inner")
return(@retnoexit )
endif
endswitch
return(@retDefault)
#EndSubroutine
OuterFormat=`WWWDLGED,6.2`
OuterCaption=`Scroll Test`
OuterX=10
OuterY=10
OuterWidth=284
OuterHeight=203
OuterNumControls=003
OuterProcedure=`OuterCallbackProc`
OuterFont=`DEFAULT`
OuterTextColor=`DEFAULT`
OuterBackground=`DEFAULT,DEFAULT`
OuterConfig=0
Outer001=`073,186,033,011,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
Outer002=`178,186,034,011,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Outer003=`004,049,275,113,MULTILINEBOX,"Multiline_1a",mlVariable1,DEFAULT,DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("Outer")
That's worked. Thanks.
I got another question in the same issue, if i want to gray out the first dialog while presenting the second so user will be focused in the dialog presented to him. How can i do that without going over all the controls and disabling them?
Thanks
If you look at the first dialog when the second is displaying, you will notice that the title bar of the first has a dimmed appearance. This is because the first or parent dialog is automatically disabled when the second or child dialog is displayed. To do more that that you could consider giving the individual controls in the parent dialog the disabled appearance by doing something like the following:
if Outer_Name == "PushButton_OK"
DialogControlState(Outer_Handle,"Multiline_1a", @dcsAddStyle, @csDisabled)
DialogControlState(Outer_Handle,"PushButton_OK", @dcsAddStyle, @csDisabled)
DialogControlState(Outer_Handle,"PushButton_Cancel", @dcsAddStyle, @csDisabled)
Dialog("Inner")
DialogControlState(Outer_Handle,"Multiline_1a", @dcsRemStyle, @csDisabled)
DialogControlState(Outer_Handle,"PushButton_OK", @dcsRemStyle, @csDisabled)
DialogControlState(Outer_Handle,"PushButton_Cancel", @dcsRemStyle, @csDisabled)
return(@retnoexit )
endif
Another option might be to change the parent dialog's background using the DialogProcOptions function's request @dpoBkground .
Hi,
I did that. In Reportview control the text keep black color. So i used DialogControlSet to change the @dcTextColor. It work fine for the text inside the Reportview but the test in the Reportview header is still black. Didn't find a way to grey it also. How can i do that?
Thanks
You can always try changing the background color.
Hi
I created a new function that disable or enable all controls ass needed. I got around 40 control in the dialog. The issue now is when i do disable it happen very fast. less then half a second. When i do enable it take around 3 seconds. This is a lot of time and look faltering or a bug. How can i speed up the enable of the controls?
Thanks
Forty controls isn't that many and it shouldn't take any longer to enable a set of controls than it takes to disable them. You likely have some kind of bug in your script. Using the WinBatch Studio debugger to step though you script can be a quick way to find the problem.