Sign in to follow this  
Followers 0
momar33

How to Create buttons that are like quicklaunch buttons?

10 posts in this topic

How would i create buttons similar to the windows quicklaunch buttons?

By this i mean that the button would appear to just be an icon until it is moused over at which point it would look like a button.

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Close, but not an icon

... just playing

#include <GUIConstants.au3>

$GUI = GUICreate("My GUI")

$b = GUICtrlCreateButton("File", 0, 0, 25, 25)
GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState()


While 1

    $m = GUIGetMsg()
    
    If $m = -3 then Exit
    
    $c = GUIGetCursorInfo($GUI)
    If $c[4] = $b Then
        GUICtrlSetState( $b, $GUI_ENABLE)
            While $c[4] = $b
                If GUIGetMsg() = $b Then Do_Function()
                $c = GUIGetCursorInfo($GUI)
            WEnd
        GUICtrlSetState( $b, $GUI_DISABLE)
    EndIf
WEnd

Func Do_Function()
    MsgBox(0x0, "tset", "OK.....    ", 3)
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

That's not a bad start.

Unfortunately when you try to use $BS_ICON with it, the button looks different and the enable disable acts differently.

Also when the button is disabled it shows up as a different color.

I'm guessing this will require the use of custom made buttons, does anyone know of any UDFs for custom buttons?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

That's not a bad start.

Unfortunately when you try to use $BS_ICON with it, the button looks different and the enable disable acts differently.

Also when the button is disabled it shows up as a different color.

I'm guessing this will require the use of custom made buttons, does anyone know of any UDFs for custom buttons?

Just a small mod to Valuater's code is all you need.

#include <GUIConstants.au3>

$GUI = GUICreate("My GUI")
$ic = GUICtrlCreateIcon("shell32.dll",22,4,4,32,32)
GUICtrlSetState(-1, $GUI_DISABLE)
$b = GUICtrlCreateButton("File", 0, 0, 40, 40,$BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",22)
GUICtrlSetState(-1,$GUI_HIDE)

;GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState()


While 1

    $m = GUIGetMsg()
   
    If $m = -3 then Exit
   
    $c = GUIGetCursorInfo($GUI)
    If $c[4] = $ic Then
        GUICtrlSetState( $b, $GUI_SHOW)
        GUICtrlSetState( $ic, $GUI_HIDE)
    ;Sleep(100)
        $c = GUIGetCursorInfo($GUI)
            While $c[4] = $b
                If GUIGetMsg() = $b Then Do_Function()
                $c = GUIGetCursorInfo($GUI)
            WEnd
        GUICtrlSetState( $b, $GUI_HIDE)
        GUICtrlSetState( $ic, $GUI_SHOW)
    EndIf
WEnd

Func Do_Function()
    MsgBox(0x0, "tset", "OK.....    ", 3)
EndFunc

EDIT:small improvement.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

that is cool.... is possible to GuiCtrlCreatePic on button down?


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites

that is cool.... is possible to GuiCtrlCreatePic on button down?

I would create the pic first and hide it. The on button click just show the pic

GUICtrlSetState( $Control, $GUI_SHOW)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

But how? :)

I am noob ;))


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites

He showed you how.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$GUI = GUICreate("My GUI")

$ic = GUICtrlCreatePic("1.jpg",0,0,100,23)

GUICtrlSetState(-1, $GUI_DISABLE)

$b = GUICtrlCreatePic("2.jpg",0,0,100,23)

GUICtrlSetState(-1,$GUI_HIDE)

$2 = GUICtrlCreatePic("3.jpg",0,0,100,23)

GUICtrlSetState(-1,$GUI_HIDE)

GUISetState()

While 1

$m = GUIGetMsg()

If $m = -3 then Exit

$c = GUIGetCursorInfo($GUI)

If $c[4] = $ic Then

GUICtrlSetState( $b, $GUI_SHOW)

GUICtrlSetState( $ic, $GUI_HIDE)

;Sleep(100)

$c = GUIGetCursorInfo($GUI)

While $c[4] = $b

If GUIGetMsg() = $b Then Do_Function()

$c = GUIGetCursorInfo($GUI)

WEnd

GUICtrlSetState( $b, $GUI_HIDE)

GUICtrlSetState( $ic, $GUI_SHOW)

EndIf

WEnd

Func Do_Function()

GUICtrlSetState( $2, $GUI_SHOW)

MsgBox(0x0, "tset", "OK..... ", 3)

EndFunc

This is fine but I want to see msg when Let that button not when I press button, like in default button !

(sorry for bad english)


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

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