Sign in to follow this  
Followers 0
MariusN

insert label into button

6 posts in this topic

I have tried this but it doesnt work...any ideas on this?

$but1 = "1"
GUICtrlSetFont(-1, 9, 700, 0, $font)
GUICtrlSetColor(-1, 0x3333FF)
$BUTTON_1 = GUICtrlCreateButton($but1 &"Help Me", 30, 150, 110, 20)

The "1" is suppose to be blue and must show on/in the "Button" of 'Help Me'

Share this post


Link to post
Share on other sites



the GUICtrlSetFont and GUICtrlSetColor won't work because $but1 isn't a control. I don't think it's possible to have multiple text colors/fonts on a button.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

the GUICtrlSetFont and GUICtrlSetColor won't work because $but1 isn't a control. I don't think it's possible to have multiple text colors/fonts on a button.

Yep, that's exactly what i want to do...changing the text of a button's font ;)

Share this post


Link to post
Share on other sites

MariusN,

You were very nearly right, but you need to use the GUICtrlSetFont/Color commands AFTER creating the control. ;) The "-1" is shorthand for "last control created":

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton_1 = GUICtrlCreateButton("Normal", 10, 10, 80, 30)


$hButton_2 = GUICtrlCreateButton("Big", 10, 100, 80, 40)
GUICtrlSetFont(-1, 18)
GUICtrlSetColor(-1, 0xFF0000)

$hButton_3 = GUICtrlCreateButton("Small", 10, 200, 80, 30)
GUICtrlSetFont(-1, 6)
GUICtrlSetColor(-1, 0x0000FF)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

MariusN,

You were very nearly right, but you need to use the GUICtrlSetFont/Color commands AFTER creating the control. ;) The "-1" is shorthand for "last control created":

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton_1 = GUICtrlCreateButton("Normal", 10, 10, 80, 30)


$hButton_2 = GUICtrlCreateButton("Big", 10, 100, 80, 40)
GUICtrlSetFont(-1, 18)
GUICtrlSetColor(-1, 0xFF0000)

$hButton_3 = GUICtrlCreateButton("Small", 10, 200, 80, 30)
GUICtrlSetFont(-1, 6)
GUICtrlSetColor(-1, 0x0000FF)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

M23

Thanks M23...noe i feel a bit better :evil: Edited by MariusN

Share this post


Link to post
Share on other sites

MariusN,

When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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