Sign in to follow this  
Followers 0
MISIIM

_GUICtrlTab_HitTest

3 posts in this topic

What am I doing wrong in this example?

#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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (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:

#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 by smashly

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0