Sign in to follow this  
Followers 0
AutoItGal

Icons & Buttons

15 posts in this topic




Autoit Wrappers... is your firend

see Icon on Button with Text (made easy)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Anyone can help me out with this? :)

Share this post


Link to post
Share on other sites

Anyone can help me out with this? :)

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Above the tab

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

; 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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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