IonicWind Software

IWBasic => GUI Central => Topic started by: Bruce Peaslee on October 08, 2010, 05:44:48 PM

Title: Need dialog handle
Post by: Bruce Peaslee on October 08, 2010, 05:44:48 PM
For tooltips, this function adds one:

ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GetControlHandle(cp,1),cp.hwnd,"Button number one"


However, cp.hwnd doesn't get past the compiler. It does work for a window.
Title: Re: Need dialog handle
Post by: WayneA on October 09, 2010, 02:40:56 AM
I used the dialog editor to make a test harness for this. I think you're saying the compiler is giving an error when cp is defined as dialog, but not window (and thus also created and handled as a windows vs dialog). This compiles fine on my end and the messagebox shows what I assume to the an accurate hWnd.

DIALOG d1
CREATEDIALOG d1,0,0,300,202,0x80C80080,0,"Caption",&d1_handler
domodal d1
end

SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
messagebox d1,str$(d1.hWnd),""
ttAddTool 0,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GetControlHandle(d1,1),d1.hwnd,"Button number one"
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
ENDSELECT
RETURN
ENDSUB


Can you provide more context for this error?
Title: Re: Need dialog handle
Post by: Bruce Peaslee on October 09, 2010, 10:16:11 AM
CREATEDIALOG dlgLot,0,0,1002,629,0x80C80080,0,"Lot Data",&dlgLot_handler

...

'Tooltips
hTooltip = ToolTipControl(dlgLot,@TTS_ALWAYSTIP,0)
ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GetControlHandle(dlgLot,LOT_CMD_MOVEUP),   dlgLot.hwnd,   "Move selected item up"  /* gives an error */
ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GetControlHandle(dlgLot,LOT_CMD_MOVEDOWN), GetParent(GetControlHandle(dlgLot,LOT_CMD_MOVEDOWN)), "Move selected item down"


The error is "undefined variable - hwnd". The line after that compiles (and works), but it is convoluted.

Edit: my mistake  ::)

I had defined dlgLot like this:

Type LOTDIALOG
   dialog dlg
   int nLotNumber
EndType

so to get the handle I must use dlgLot.dlg.hwnd

I dug deeper when your example compiled just fine. Thanks.