Software Archive
Read-only legacy content

Dialog queries

Intel_C_Intel
Employee
644 Views
Hi,

I am developing a quickwin app using cvf 6.6 .

Is there any way I can make the "return" key act like a tab key within a dialog box ? At the moment I trap the "return" key (IDOK) using a dummy callback routine. Could I change the dummy routine to move forward to the next control ? Can I in fact set the focus on a given control ?

Of lesser concern, is there a way to change the text of an existing list item in a list box ? At the moment I reload the entire list box.

Bill Buchholz
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
644 Views
Is there any way I can make the "return" key act like a tab key within a dialog box ? At the moment I trap the "return" key (IDOK) using a dummy callback routine. Could I change the dummy routine to move forward to the next control ? Can I in fact set the focus on a given control ?

See here. You can set focus explicitly using SetFocus(GetDlgItem(Dlg%hWnd, IDC_CONTROL)) or adjust tab stops in dialog editor (Ctrl+D) and send WM_NEXTDLGCTL.

Of lesser concern, is there a way to change the text of an existing list item in a list box ? At the moment I reload the entire list box.

Yes, that was always possible, though docs could be a bit clearer. Use
 
j = DlgSet(Dlg, IDC_LIST1, "nTh Item", n) 

where n is index of the item in the list.

Jugoslav
0 Kudos
Intel_C_Intel
Employee
644 Views
Thanks for your reply. The link certainly made it clear that it can be
done but I just could not get it to work. I am not sure how to set the parameters.

I had the line:
STATUS = DLGSENDCTRLMESSAGE (DLG,IDOK,WM_NEXTDLGCTL,0,0)
which returns false after executing.

IDOK is the invisible default button mentioned in the link and the
callback routine is certainly called when return key is pressed.

The problem is that I don't know the previous and next controls so that
I can put useful information in the wparam and lparam. And I don't know the usefulness of setting controlid = idok which is simply the ID of the
callback routine.

Would really appreciate any help,

Bill
0 Kudos
Jugoslav_Dujic
Valued Contributor II
644 Views
WM_NEXTDLGCTL should be sent to the dialog, i.e.
 
j = SendMessage(Dlg%hWnd, WM_NEXTDLGCTL, 0, 0) !next control 
j = SendMessage(Dlg%hWnd, WM_NEXTDLGCTL, 1, 0) !previous control 

If you want finer control, you might play with GetNextDlgTabItem combined with WM_NEXTDLGCTL(but with 1 as lParam), GetDlgItem, GetDlgCtrlID.

Jugoslav
0 Kudos
Intel_C_Intel
Employee
644 Views
Just to say thanks for the help.

Now for some retro-fitting of older dialog boxes.

Being a humble quickwin programmer, it seems to be a lot of guesswork
before getting these system calls to work. It would be nice to have
a few more samples showing how to use these system calls.

Bill

to work.
0 Kudos
Reply