Jump to content

Problem with button over "CreateInput"


Recommended Posts

Hi,

I have a GUI with multiple-tabs and I want to GUICtrlCreateButton over GUICtrlCreateInput in 1 of my tab

so I ask my best-friend (Google) and I found this:

#include <GUIConstants.au3>
$Gui = GuiCreate("Test", 320, 100)
$Button = GUICtrlCreateButton("...", 290, 42, 18, 18)
$Input = GUICtrlCreateInput("C:\", 10, 40, 300, 22, $WS_CLIPSIBLINGS)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd

it working fine if you have no tab but as soon as you add 1 tab..

the Input is there but not shown?

#include <GUIConstants.au3>
#include <GuiTab.au3>
$Gui = GuiCreate("Test", 320, 100)
$tab1 = GUICtrlCreateTab(-1, -1, 315, 80)
GUICtrlCreateTabItem("Test")
_GUICtrlTabSetBkColor($Gui, $tab1)
$Button = GUICtrlCreateButton("...", 290, 42, 18, 18)
$Input = GUICtrlCreateInput("C:\", 10, 40, 300, 22, $WS_CLIPSIBLINGS)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd

;~  ---------------------------------- Start Func GUICtrlTabSetBkColor ----------------------------------
Func _GUICtrlTabSetBkColor($hWnd, $hSysTab32)
    Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)
    Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1)

    GUICtrlCreateLabel(Null, $aTabPos[0] + 2, $aTabPos[1] + $aTab_Rect[3] + 4, $aTabPos[2] - 6, $aTabPos[3] - $aTab_Rect[3] - 7)
    GUICtrlSetBkColor(-1, 0xF0F0F0)
    GUICtrlSetState(-1, $GUI_DISABLE)
EndFunc   ;==>_GUICtrlTabSetBkColor
;~  ---------------------------------- End Func GUICtrlTabSetBkColor ----------------------------------

what did i miss?? ­čśĽ

Link to post
Share on other sites

I recommend to check out this post by @Melba23: 

 

 

As mentioned 

Quote

You cannot overlap controls in AutoIt - it cannot´╗┐┬áread your mind and determine which┬á´╗┐control you wish to be on´╗┐┬átop and action and so┬á´╗┐decides to action´╗┐´╗┐┬áneither´╗┐´╗┐´╗┐´╗┐.┬á´╗┐´╗┐

It looks like that is specifically more talking about the Graphic/Pic, but I think that it applies here. Looking at your code, you're also missing a closing:

GUICtrlCreateTabItem("")

As mentioned in the helpfile here: GUICtrlCreateTab. Ideally I think this should be (currently) after your $Input control is created. Any way, unless someone with more GUI knowledge comes by with more information, I just don't think that stacking the controls is going to work. Not in a good fashion, at least.

 

That being said, after playing around with it, I think that I did get it working. Check this out:

#include <GUIConstants.au3>
#include <GuiTab.au3>
$Gui = GuiCreate("Test", 320, 100, -1, -1, -1, $WS_EX_COMPOSITED)
$tab1 = GUICtrlCreateTab(-1, -1, 315, 80)
GUICtrlCreateTabItem("Test")
_GUICtrlTabSetBkColor($Gui, $tab1)
$Button = GUICtrlCreateButton("...", 290, 42, 18, 18)
$Input = GUICtrlCreateInput("C:\", 10, 40, 300, 22)
GUICtrlCreateTabItem("")
GUICtrlSetState($Input, $GUI_ONTOP)
GUICtrlSetState($Button, $GUI_ONTOP)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

;~  ---------------------------------- Start Func GUICtrlTabSetBkColor ----------------------------------
Func _GUICtrlTabSetBkColor($hWnd, $hSysTab32)
    Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)
    Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1)

    GUICtrlCreateLabel(Null, $aTabPos[0] + 2, $aTabPos[1] + $aTab_Rect[3] + 4, $aTabPos[2] - 6, $aTabPos[3] - $aTab_Rect[3] - 7)
    GUICtrlSetBkColor(-1, 0xF0F0F0)
    GUICtrlSetState(-1, $GUI_DISABLE)
EndFunc   ;==>_GUICtrlTabSetBkColor
;~  ---------------------------------- End Func GUICtrlTabSetBkColor ----------------------------------

image.png.8dea6c6ccdb6ceccfef3d63652d6c5e7.png

The Button and Input are both visible, and accessible, however text will be cut off/ hidden slightly by the button.

RAWR! I'm hungry :( Feed the panda squirrle

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...