May 09, 2024, 10:22:53 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Need dialog handle

Started by Bruce Peaslee, October 08, 2010, 05:44:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

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.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

WayneA

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?
99 little bugs in the code,
99 bugs in the code,
Fix one bug,
Compile again,
104 little bugs in the code...

All code I post is in the public domain.

Bruce Peaslee

October 09, 2010, 10:16:11 AM #2 Last Edit: October 09, 2010, 10:28:16 AM by peaslee
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.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles