Jump to content

Recommended Posts

Posted

Hi ,

Your code works. But I have a problem. When I create a tab using "GUICTRLCREATETAB", the tab window covers the button and the text. How to make it visible?

Posted

Can you post the code you're having problems with...

Here is the code by Valuater added a tab window. When I add the tab window, the button will be blocked by the tab window. Please help me.

Thanks.

; Icon on Button - (made easy)
; Author - Valuater

#include <GUIConstants.au3>

$mywin = GUICreate("my gui")
$tab=GUICtrlCreateTab(30,30,500,455); Added a tab window here. This will cover the button up.
$btn1 = IconButton("Help", 30, 30, 70, 32, 23)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $btn1 Then MsgBox(0,0,"You pressed the Icon Button  ", 2)
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll")
    GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16)
    GUICtrlSetState( -1, $GUI_DISABLE)
    $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS)
    Return $XS_btnx
EndFunc
Posted

Here is the code by Valuater added a tab window. When I add the tab window, the button will be blocked by the tab window. Please help me.

Thanks.

Do you want the button on the tab? Or above the tab?

Posted

Above the tab

Then you need to change the co-ordinates of your tab and/or button; both right now are at 30, 30 so naturally they are occupying the same space.

Try changing these two lines as follows:$tab=GUICtrlCreateTab(30,50,500,455); Added a tab window here. This will cover the button up.

$btn1 = IconButton("Help", 30, 10, 70, 32, 23)

Posted

Then you need to change the co-ordinates of your tab and/or button; both right now are at 30, 30 so naturally they are occupying the same space.

Try changing these two lines as follows:$tab=GUICtrlCreateTab(30,50,500,455); Added a tab window here. This will cover the button up.

$btn1 = IconButton("Help", 30, 10, 70, 32, 23)

This does not solve my problem. I want the button on top of the tab window. I have several tab windows, and I want to put some buttons on top of each of the tab windows.

Posted

; Icon on Button - (made easy)
; Author - Valuater

#include <GUIConstants.au3>

$mywin = GUICreate("my gui",600,500)
$tab=GUICtrlCreateTab(30,30,500,455); Added a tab window here. This will cover the button up.
$tab1=GUICtrlCreateTabitem ("tab1")
$btn1 = IconButton("Help1", 30, 50, 70, 32, 23)
$tab2=GUICtrlCreateTabitem ("tab2")
$btn2 = IconButton("Help2", 30, 100, 70, 32, 23)
GUICtrlCreateTabitem (""); end tabitem definition
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $btn1 Then MsgBox(0,0,"You pressed the Icon Button  ", 2)
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll")
    GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16)
    GUICtrlSetState( -1, $GUI_DISABLE)
    $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS)
    Return $XS_btnx
EndFunc

Posted

; Icon on Button - (made easy)
; Author - Valuater

#include <GUIConstants.au3>

$mywin = GUICreate("my gui",600,500)
$tab=GUICtrlCreateTab(30,30,500,455); Added a tab window here. This will cover the button up.
$tab1=GUICtrlCreateTabitem ("tab1")
$btn1 = IconButton("Help1", 30, 50, 70, 32, 23)
$tab2=GUICtrlCreateTabitem ("tab2")
$btn2 = IconButton("Help2", 30, 100, 70, 32, 23)
GUICtrlCreateTabitem (""); end tabitem definition
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $btn1 Then MsgBox(0,0,"You pressed the Icon Button  ", 2)
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll")
    GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16)
    GUICtrlSetState( -1, $GUI_DISABLE)
    $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS)
    Return $XS_btnx
EndFunc

The button is still hidden....

Posted

Try this and you will see there is some problem in IconButton()

#include <GUIConstants.au3>

$mywin = GUICreate("my gui",600,500)
$tab=GUICtrlCreateTab(30,30,500,455); Added a tab window here. This will cover the button up.
$tab1=GUICtrlCreateTabitem ("tab1")
$btn1 = GUICtrlCreateButton("Help1", 30, 60, 70, 32)
;~ $btn1 = IconButton("Help1", 30, 60, 70, 32, 23)
$tab2=GUICtrlCreateTabitem ("tab2")
$btn2 = GUICtrlCreateButton("Help2", 30, 100, 70, 32)
;~ $btn2 = IconButton("Help2", 30, 100, 70, 32, 23)
GUICtrlCreateTabitem (""); end tabitem definition
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $btn1 Then MsgBox(0,0,"You pressed the Icon Button  ", 2)
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll")
    GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16)
    GUICtrlSetState( -1, $GUI_DISABLE)
    $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS)
    Return $XS_btnx
EndFunc
Posted

Without Tabs it's working OK:

#include <GUIConstants.au3>

$mywin = GUICreate("my gui",600,500)
$btn1 = IconButton("Help1", 30, 60, 70, 32, 23)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $btn1 Then MsgBox(0,0,"You pressed the Icon Button  ", 2)
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll")
    GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16)
    GUICtrlSetState( -1, $GUI_DISABLE)
    $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS)
    Return $XS_btnx
EndFunc

I don't know how to fix this.

Maybe use STM_SETIMAGE message, see my post

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...