Simple Dialogue Question, Help Please :-)

Started by freedom45, June 17, 2013, 08:54:54 PM

Previous topic - Next topic

freedom45

Date:    Monday, June 17, 2013 07:41 PM   

  Hi,

I have a very simple question about Winbatch dialogues. ???

I wrote a little program with a dialogue with a few buttons and an ITEMBOX. I would like to always have the ITEMBOX field in FOCUS (Default for the user), but for some reason it is the "Stop" button that is the default.

Can anyone please help,
This is much appreciated, thanks in advance,
Dan


ClientFormat =`WWWDLGED,6.1`
ClientCaption =ClientTitleBar
ClientX =005
ClientY =005
ClientWidth =630
ClientHeight =360
ClientNumControls =008
ClientProcedure = `ClientDLG` ;<=name of your callback procedure

Client001=`015,227,170,025,GROUPBOX,DEFAULT,"Commands",DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client002=`020,235,036,012,PUSHBUTTON,DEFAULT,"&Start",2,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client003=`060,235,036,012,PUSHBUTTON,DEFAULT,"S&top",3,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client004=`100,235,036,012,PUSHBUTTON,DEFAULT,"&Get Logs",4,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

Client005=`015,022,124,012,STATICTEXT,DEFAULT,"Status: ",DEFAULT,5,DEFAULT,"Arial|9728|1040|34","0|0|0",DEFAULT`

; Display ITEMBOX Status
Client006=`015,035,178,200,ITEMBOX,ItemList,DEFAULT,DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

; Display Status
Client007=`050,025,124,012,VARYTEXT,Edit8,"",DEFAULT,7,1,"Arial|6656|1070|34","128|0|0",DEFAULT`

; Exit was pressed
Client008=`140,235,036,012,PUSHBUTTON,DEFAULT,"E&xit",24,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("Client")

....IFICantBYTE

In the dialog editor, right-click each control and go to Attributes.
In the Attributes, you will see TAB order ... make the control you want as the default (to get focus when the dialog is started) the LOWEST value of all your active controls.
Note that a GroupBox's TAB order directs the focus to the controls it contains before going to the next groupbox or control outside it .. if you get what I mean .. anyway, play with the TAB order and you will work it out.
(Also, if you have a dynamic dialog, you can also redirect the focus to a particular control programatically.. look in help for DialogControlState )

Regards,
....IFICantBYTE
Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

Deana

Tab order is important when trying to specify which control should have focus.

From the WIL Help File:
Quotetab order: Allows you to specify a control's tab order independently of a control's position or name in the dialog template. Tab-order controls the order in which controls are accessed when the keyboard is used to navigate the dialog. It also influences which control is on top when controls have overlapping positions in the dialog. It can be any positive integer, but each control should have a unique number.

When you navigate through a dialog using the tab key, lower number controls will be given the keyboard focus before higher controls. Likewise, low-numbered overlapping controls will appear on top of higher numbered controls. If you specify the DEFAULT keyword for this attribute or if you give two controls the same tab order, a tab order will be arbitrarily assigned to the control.

Note: The dialog function, under certain circumstances, may change the tab order you specify. The GROUPBOX controls tab order may be adjusted so that it is smaller than any of the controls it contains. In addition, the tab order of the controls inside the GROUPBOX may be adjusted so that they are consecutive.

Here is the revised code, where each controls tab-order has been modified. The key is to make the ITEMBOX have the lowest tab order.

Code (winbatch) Select

ClientFormat=`WWWDLGED,6.1`

ClientCaption=ClientTitleBar
ClientX=005
ClientY=005
ClientWidth=630
ClientHeight=359
ClientNumControls=008
ClientProcedure=`ClientDLG`
ClientFont=`DEFAULT`
ClientTextColor=`DEFAULT`
ClientBackground=`DEFAULT,DEFAULT`
ClientConfig=0

Client001=`015,227,170,024,GROUPBOX,DEFAULT,"Commands",DEFAULT,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client002=`021,235,036,012,PUSHBUTTON,DEFAULT,"&Start",2,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client003=`061,235,036,012,PUSHBUTTON,DEFAULT,"S&top",3,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client004=`101,235,036,012,PUSHBUTTON,DEFAULT,"&Get Logs",4,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client005=`015,023,124,012,STATICTEXT,DEFAULT,"Status:",DEFAULT,6,DEFAULT,"Arial|9728|1040|34","0|0|0",DEFAULT`
Client006=`015,035,178,200,ITEMBOX,ItemList,DEFAULT,DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Client007=`051,025,124,012,VARYTEXT,Edit8,DEFAULT,DEFAULT,7,1,"Arial|6656|1070|34","128|0|0",DEFAULT`
Client008=`141,235,036,012,PUSHBUTTON,DEFAULT,"E&xit",24,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("Client")


Note: You can also change control focus inside a DialogCallBack procedure.

Deana F.
Technical Support
Wilson WindowWare Inc.

freedom45

Great, this is exactly what I needed. 
Thank you.
Dan :)