MISIIM Posted March 26, 2008 Posted March 26, 2008 What am I doing wrong in this example? expandcollapse popup#include <GuiTab.au3> Opt("MouseCoordMode", 2); Local $gui = GUICreate(""); GUISetState(@SW_SHOW, $gui) Local $tab = _GUICtrlTab_Create($gui, 20, 20); _GUICtrlTab_InsertItem($tab, 0, "Bla"); Local $lastState; Local $user32 = DllOpen("user32.dll"); While True If _IsPressed("04", $user32) And Not $lastState Then If WinActive($gui) Then Local $hittest = _GUICtrlTab_HitTest($tab, -1, -1); MsgBox(0, $hittest[0], $hittest[1]); Local $hittest = _GUICtrlTab_HitTest($tab, MouseGetPos(0), MouseGetPos(1)); MsgBox(0, $hittest[0], $hittest[1]); EndIf $lastState = True Else $lastState = False EndIf If GUIGetMsg() = -3 Then ExitLoop; WEnd DllClose($user32)
smashly Posted March 28, 2008 Posted March 28, 2008 (edited) I honestly think there is something wrong with _GUICtrlTab_HitTest() If you create a tab at a X and Y position that is greater 10 in your gui then the function appears to partially fail, actually at X & Y @ 20 then the function doesn't work at all. If you create the tab X & Y position in between 0 and 10 in your gui then the _GUICtrlTab_HitTest() works fine To me that indicates a bug. Cheers Edit 4 examples 1st works as it should using found GetCursorInfo for the Hittest and tab X & Y created @ 5:expandcollapse popup#include <GuiTab.au3> #include <Misc.au3> $gui = GUICreate(""); Local $tab = GUICtrlCreateTab(5, 5); _GUICtrlTab_InsertItem($tab, 0, "Bla0"); _GUICtrlTab_InsertItem($tab, 1, "Bla1"); GUISetState(@SW_SHOW, $gui) While 1 $GCCI = GUIGetCursorInfo($gui) If _IsPressed("01") Then Local $hit = _GUICtrlTab_HitTest($tab, $GCCI[0], $GCCI[1]); MsgBox(0, $hit[0], $hit[1]); EndIf If GUIGetMsg() = -3 Then ExitLoop; WEndoÝ÷ ÛiÝ}¨¥²ë"´+«²Èú¢»axxµë-Â+aµ¦×jjXr·µçvÑ«¢+Ø¥¹±Õ±ÐíÕ¥Q¹ÔÌÐì(¥¹±Õ±Ðí5¥Í¹ÔÌÐì((ÀÌØíÕ¤ôU% ÉÑ ÅÕ½ÐìÅÕ½Ðì¤ì)1½°ÀÌØíÑôU% Ñɱ ÉÑQ ÈÀ°ÈÀ¤ì)}U% ÑɱQ}%¹ÍÉÑ%Ñ´ ÀÌØíѰÀ°ÅÕ½Ðí ±ÀÅÕ½Ðì¤ì)}U% ÑɱQ}%¹ÍÉÑ%Ñ´ ÀÌØíѰİÅÕ½Ðí ±ÄÅÕ½Ðì¤ì)U%MÑMÑÑ¡M]}M!=°ÀÌØíÕ¤¤()]¡¥±Ä($ÀÌØí $ôU%Ñ ÕÉͽÉ%¹¼ ÀÌØíÕ¤¤(%}%ÍAÉÍÍ ÅÕ½ÐìÀÄÅÕ½Ðì¤Q¡¸($1½°ÀÌØí¡¥Ðô}U% ÑɱQ}!¥ÑQÍÐ ÀÌØíѰÀÌØí %lÁt°ÀÌØí %lÅt¤ì($5Í ½à À°ÀÌØí¡¥ÑlÁt°ÀÌØí¡¥ÑlÅt¤ì(%¹%$(%U%Ñ5Í ¤ô´ÌQ¡¸á¥Ñ1½½Àì)]¹oÝ÷ ÛzݲçyçlÂ+aªÝ±ëaÛ^²ÛÚç¬Â+aµ¦×jjXr·µçyjëh×6#include <GuiTab.au3> #include <Misc.au3> $gui = GUICreate(""); Local $tab = GUICtrlCreateTab(5, 5); _GUICtrlTab_InsertItem($tab, 0, "Bla0"); _GUICtrlTab_InsertItem($tab, 1, "Bla1"); GUISetState(@SW_SHOW, $gui) While 1 If _IsPressed("01") Then Local $hit = _GUICtrlTab_HitTest($tab, 7, 7); MsgBox(0, $hit[0], $hit[1]); EndIf If GUIGetMsg() = -3 Then ExitLoop; WEndoÝ÷ Ûa}¨¥³«vÇ+mzËoj[³Ö]©©aÊÞj×ÛF®¶sb6æ6ÇVFRfÇC´wVF"æS2fwC°¢6æ6ÇVFRfÇC´Ö62æS2fwC° ¢b33c¶wVÒuT7&VFRgV÷C²gV÷C²°¤Æö6Âb33c·F"ÒuT7G&Ä7&VFUF"#Â#°¥ôuT7G&ÅF%ôç6W'DFVÒb33c·F"ÂÂgV÷C´&ÆgV÷C²°¥ôuT7G&ÅF%ôç6W'DFVÒb33c·F"ÂÂgV÷C´&ÆgV÷C²°¤uT6WE7FFR5uõ4õrÂb33c¶wV ¥vÆR bô5&W76VBgV÷C³gV÷C²FVà Æö6Âb33c¶BÒôuT7G&ÅF%ôEFW7Bb33c·F"Â#"Â#"° ×6t&÷Âb33c¶E³ÒÂb33c¶E³Ò° VæD`¢buTvWD×6rÒÓ2FVâWDÆö÷°¥tVæ@ Edited March 28, 2008 by smashly
GaryFrost Posted March 28, 2008 Posted March 28, 2008 X, Y is relative to the tab, not relative to the Window SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now