Sign in to follow this  
Followers 0
PreludeOfDeath

Pictures and Text on a Button

6 posts in this topic

I want to Create a Button... With NO text on it...

But, then I want to display a picture and a bunch of text on top of it...

The Reason:

So that when someone clicks on the text, or the picture, or anything within that button, it selects the same thing.

Do I have to set up a separate 'on click' for all of the objects or can I just make the button be pressed every time?

My Problem:

The Button wants to be on TOP... Always! And if it isnt on top, and i move my mouse over it, it goes on top... how do i stop this?

Plz Help! thanks!

Share this post


Link to post
Share on other sites



Dont use a button at all!

$pic = createpic()

$label = createlabel()

while 1

$msg = get message()

If $msg = $pic or $msg = $label then ;Do this

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is the method I use because I need to be able to Grab Focus on and Tab through all my buttons.

$Button = GUICtrlCreateButton ("", 736, 224, 131, 25,$BS_BITMAP)
GUICtrlSetImage ($Button, ".\test.bmp")
Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The Button wants to be on TOP... Always! And if it isnt on top, and i move my mouse over it, it goes on top... how do i stop this?

Try this. Press the button and the icon appears in the button, press it again and the text appears over the icon in the button.

#include <guiconstants.au3>
$g = GUICreate("")

$i = GUICtrlCreateIcon("shell32.dll",22,15,15,16,16)
GUICtrlSetState(-1,$GUI_HIDE)
$l = GUICtrlCreateLabel('abcdef',15,15,20,18);,$WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1,$GUI_HIDE)

$b = guictrlcreatebutton("",10,10,40,40,$WS_CLIPSIBLINGS)

GUISetState()

$n = 0

While 1
    $m = GUIGetMsg()
    
    
    Switch $m
        Case $GUI_EVENT_CLOSE
            Exit
        Case $b,$i,$l
            If $n = 0 Then
                ConsoleWrite("step 1")
                GUICtrlSetState($i,$GUI_SHOW)
                $n += 1
            ElseIf $n = 1 Then
                ConsoleWrite(", step 2")
                GUICtrlSetState($l,$GUI_SHOW)
                $n += 2
            Else
                MsgBox(0,'error','Nothing left To Do')
            EndIf
    EndSwitch
    
    
WEnd
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

#5 ·  Posted (edited)

you could just use his method and just put text in as the pic...

This is the method I use because I need to be able to Grab Focus on and Tab through all my buttons.

CODE: AutoIt

$Button = GUICtrlCreateButton ("", 736, 224, 131, 25,$BS_BITMAP)

GUICtrlSetImage ($Button, ".\test.bmp")

Edited by toothyXdip

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝

Share this post


Link to post
Share on other sites

Thank You Everyone for your Fast and Helpful replies!

I am at work right now, but when I get home I will be trying these all out to see what works best!

Thank You Again!!!

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