Jump to content

Pictures and Text on a Button


Recommended Posts

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!

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...