- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to use a combo box with the following code:
lret = DlgSet(gdlg, IDC_Contract_COMBO, 2, DLG_NumItems)
lret = DlgSet(gdlg, IDC_Contract_COMBO, "MEAf0203", 1)
lret = DlgSet(gdlg, IDC_Contract_COMBO, "NH0102", 2)
When I run the program there is nothing listed in the combo box. Any thoughts?
Mike
lret = DlgSet(gdlg, IDC_Contract_COMBO, 2, DLG_NumItems)
lret = DlgSet(gdlg, IDC_Contract_COMBO, "MEAf0203", 1)
lret = DlgSet(gdlg, IDC_Contract_COMBO, "NH0102", 2)
When I run the program there is nothing listed in the combo box. Any thoughts?
Mike
Link Copied
11 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, several thoughts...
- you misspelled combo ID
- you forgot to INCLUDE "Resource.fd"
- what's the value of lret?
- you misspelled combo ID
- you forgot to INCLUDE "Resource.fd"
- what's the value of lret?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Things are spelled correcly I think, otherwise I couldn't have compiled. Also, included resouce.fd is a few lines up, and is also necessary to compile.
But, lret is .false.
But, lret is .false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The only errors that come on my mind are stupid, like not calling DlgInit for the dialog -- hey, did you check the success of DlgInit? Does DlgSet work for other controls?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah ... everything else checks out. DlgInit is .true. for the Dialog, and other DlgSets are coming back as .true. The combo box does show up when I execute .. it's just blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks as if you'll have to step in into DlgSet to see why it fails -- if it won't step in from the debugger, try including DFLOGM.f90 from .../DF98/Include. I'm out of ideas (and the ones so far weren't very bright :-D).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In stepping through DlgSet it seems to get kicked out under the "ingnore unsupported controls" portion of the routine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take a look at the source of .rc file -- it's probably a COMBOBOXEX (the last on the resource palette). If I'm right, delete it & insert an ordinary combo box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have had the same problem with combo box and it took me several days and much frustration to solve. First, look at the sample program CELSICON where you are going to find an undocumented feature and a little subroutine called DoCallBackInit to set callback for WM_INITDIALOG, which is needed just for combo box. I found this one myself. But the combo box showed only one item at run time. This one was a design time difficulty which I couldn't solve without help from vf-support. You need to set the size of the dropdown list. One merely clicks on the window and moves the edges with the mouse. But the dropdown list window will not show at design time unless you click on the down arrow on the right side of the current selection window. Once you see the dropdown list window, you can size it with the mouse just like the current selection window. Easy, only if I knew it!
Sabalan.
Sabalan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sabalan,
DoCallBackInit is undocumented for a good reason -- there's standard way to do it:
Jugoslav
DoCallBackInit is undocumented for a good reason -- there's standard way to do it:
DlgSetSub(Dlg, IDD_DIALOG1, OnDialogInit).Why is it needed only for combo box? Combo boxes used to work normally (I don't have time right now to test it). It is required for tab control to work only AFAIK. I agree that the trick with sizing of dropdown list is tricky to deduce indeed (albeit documented somewhere in depth of rc help).
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know Yugoslav. I just followed "Using list boxes and combo boxes" in the on-line help, and the combo box did not work, as it didn't for Mike either. Then I searched in samples and found out what I wrote here. The comment about "undocumented feature" is cited directly from the sample code CELSICON. It is a DlgSetSub as you write but in the subroutine DoCallBackInit, which is called instead of your OnDialogInit, there is a SetDlgItemText which I couldn't find anywhere in the on-line help.
Sabalan.
Sabalan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, sorry, I misread your statement -- I thought DoCallBackInit was an undocumented routine from DFLOGM.f90; actually, it was a routine from CelsIcon.
That DlgSetSub feature for WM_INITDIALOG is definitely documented now (see DlgSetSub). I'd guess that it wasn't documented earlier, at the time when CelsIcon was written. Maybe it was accompanied with a bug in combo box handling (DLG_STATE in code below); SetDlgItemText is a Win32 API routine. I'm just guessing.
I've just assembled a simple test program and it worked just fine on CVF6.6:
That DlgSetSub feature for WM_INITDIALOG is definitely documented now (see DlgSetSub). I'd guess that it wasn't documented earlier, at the time when CelsIcon was written. Maybe it was accompanied with a bug in combo box handling (DLG_STATE in code below); SetDlgItemText is a Win32 API routine. I'm just guessing.
I've just assembled a simple test program and it worked just fine on CVF6.6:
PROGRAM ComboTest USE DFLOGM IMPLICIT NONE INCLUDE "Resource.fd" TYPE(Dialog):: Dlg INTEGER:: iSt iSt = DlgInit(IDD_DIALOG1, Dlg) iSt = DlgSet(Dlg, IDC_COMBO1, 2, DLG_NUMITEMS) iSt = DlgSet(Dlg, IDC_COMBO1, "AAA", 1) iSt = DlgSet(Dlg, IDC_COMBO1, "BBB", 2) iSt = DlgSet(Dlg, IDC_COMBO1, "CCC", DLG_STATE) iSt = DlgModal(Dlg) END PROGRAM ComboTest
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page