Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hover Over Tab Changes Tab in MultiTabDialog
#1
Hi Gintaras,
I was wondering if you or anyone else in the forum can figure out a way to make a hover-over effect that changes a multi-tab dialog's tab selection.
I modified some dialog's in the resources to get close


Function dlg_DoSomethingOnMouseOver
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str+ Tab1 = "Tab1"
str+ Tab2 = "Tab2"
str+ Tab3 = "Tab3"


;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 141 "Dialog"
;1001 Static 0x44020000 0x4 94 58 48 13 "Page0"
;1101 Static 0x44020000 0x4 100 56 48 13 "Page1"
;1201 Static 0x44020000 0x4 102 54 48 13 "Page2"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 SysTabControl32 0x54000040 0x0 0 2 230 76 ""
;6 Static 0x54030100 0x4 0 114 48 13 "Text6"
;5 Static 0x54030100 0x4 0 98 48 13 "Text5"
;4 Edit 0x54230844 0x20000 54 82 152 30 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030202 "" "0" ""
if(!ShowDialog("dlg_DoSomethingOnMouseOver" &dlg_DoSomethingOnMouseOver)) ret
ret
;messages
int z
z=DT_DoSomethingOnMouseOver(hDlg message wParam lParam id(6 hDlg) 0xff0000 0x00ffff)
if(z) ret z
z=DT_DoSomethingOnMouseOver(hDlg message wParam lParam id(5 hDlg) 0xff0000 0x00ffff)
if(z) ret z
z=DT_DoSomethingOnMouseOver(hDlg message wParam lParam id(3 hDlg) 0xff0000 0x00ffff)
if(z) ret z
sel message
,case WM_INITDIALOG
,,int htb=id(3 hDlg)
,,TCITEM ti.mask=WINAPI.TCIF_TEXT
,,ti.pszText=Tab1;;"MRI Brain 10-17-2009"
,,SendMessage htb WINAPI.TCM_INSERTITEMA 0 &ti
,,ti.pszText=Tab2
,,SendMessage htb WINAPI.TCM_INSERTITEMA 1 &ti
,,ti.pszText=Tab3
,,SendMessage htb WINAPI.TCM_INSERTITEMA 2 &ti        
,,goto g11
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY
,,goto messages3
,case WM_SETCURSOR
ret
;messages2
sel wParam
,case STN_CLICKED<<16|3
,out 1
,case IDOK
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case WINAPI.TCN_SELCHANGE
,,_i=SendMessage(nh.hwndFrom WINAPI.TCM_GETCURSEL 0 0)
,,;g11
,,DT_Page hDlg _i;

and

Function DT_DoSomethingOnMouseOver
Code:
Copy      Help
;/
function# hDlg message wParam lParam hctrl backcolor textcolor


sel message
,case WM_SETCURSOR
,if child(mouse)=hctrl
,,if hctrl = id(6 win("Dialog" "#32770"))
,,,_s="Text6";
,,,_s.setwintext(id(4 win("Dialog" "#32770")))    
,,,;_s.setwintext(id(1201 win("Dialog" "#32770")))
,,if hctrl = id(5 win("Dialog" "#32770"))
,,,_s="Text5";
,,,_s.setwintext(id(4 win("Dialog" "#32770")))                
,,,_s.setwintext(id(4 win("Dialog" "#32770")))
,,,_s.setwintext(id(1001 win("Dialog" "#32770")))        
,,if hctrl = id(3 win("Dialog" "#32770"))
,,,_s="TabCrl 3";
,,,_s.setwintext(id(4 win("Dialog" "#32770")))
,,;,_s.setwintext(id(1001 win("Dialog" "#32770")))    
,,SetTimer hDlg 33345 50 0
,case WM_TIMER
,if(wParam=33345 and child(mouse)!=hctrl)
,,;out "2 %i" hctrl
,,KillTimer hDlg wParam
,case WM_DESTROY

But this only changes the textbox entry on hovering over a static element. I would like to do this for hovering over the tabs to cause either a text box to change or to actually select the tab itself.

Thanks so much for any ideas or directions to try....

Stuart
#2
Function DT_DoSomethingOnMouseOver
Code:
Copy      Help
;/dlg_DoSomethingOnMouseOver
function# hDlg message wParam lParam hctrl backcolor textcolor


sel message
,case WM_SETCURSOR
,if child(mouse)=hctrl
,,sel GetWinId(hctrl)
,,,case 6
,,,_s="Text6";
,,,_s.setwintext(id(4 hDlg))
,,,;_s.setwintext(id(1201 hDlg))
,,,case 5
,,,_s="Text5";
,,,_s.setwintext(id(4 hDlg))
,,,_s.setwintext(id(4 hDlg))
,,,_s.setwintext(id(1001 hDlg))
,,,case 3
,,,_s="TabCrl 3";
,,,_s.setwintext(id(4 hDlg))
,,,;_s.setwintext(id(1001 hDlg))
,,,
,,,TCHITTESTINFO ti
,,,xm ti.pt hctrl 1
,,,int t=SendMessage(hctrl TCM_HITTEST 0 &ti)
,,,;out "%i %i" t ti.flags
,,,if(t>=0 and t!=SendMessage(hctrl TCM_GETCURSEL 0 0)) PostMessage(hctrl TCM_SETCURFOCUS t 0)
,,,
,,,
,,;SetTimer hDlg 33345 50 0
,;case WM_TIMER
,;if(wParam=33345 and child(mouse)!=hctrl)
,,;;out "2 %i" hctrl
,,;KillTimer hDlg wParam
,;case WM_DESTROY
#3
Unbelievable Gintaras, you're my HERO!!!
thanks so much.....
I can do a lot on my own with QM but a lot of that SendMessage stuff is beyond me. I actually use it a lot by reverse-engineering code examples like resetting listboxes but to create new stuff...wow!!!

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)