combo and edit boxes

combo and edit boxes

Hi,
I had posted a message earlier regarding using a combo or an edit box depending on a set of radio buttons selected.Using 2 different boxes solved the problem but I am having problems during the initialization.I am unable to change the visibility options(having the edit box visible sometimes and the combo box visible at other times) when the dialog box first pops up.
The showwindow function works only from the call back routine so i tried explicitly calling the callback routine but it still doesn't work.
Any pointers on this?
--rswy

2 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Yes, you can't use APIs in initialization phase (between DlgInit and DlgModal) due to architecture of DFLOGM. Namely, all APIs expect an existing window , but the dialog (and its controls) is not created prior to DlgModal, and then it's too late since it's modal.

To overcome that, the common trick is to use a special callback, called at dialog's initialization:

EXTERNAL OnDlgInit
...
DlgInit(...
iSt=DlgSetSub(Dlg,IDD_DIALOG1,OnDlgInit)
...
DlgModal(...

Note use of dialog ID. OnDlgInit has normal arguments (Dlg, ID, iEvent) and it's called immediately after the dialog is created but before it's displayed (roughly, imagine that it's called by DlgModal immediately). You can put all additional API stuff initialization there (ShowWindow, change dialog title via SetWindowText, use SendMessage for features not supported via DFLOGM etc.).

XFLOGM has DLG_VISIBLE extension just for that purpose.

Jugoslav

Jugoslav
www.xeffort.com

发表评论

登录添加评论。还不是成员?立即加入