Jump to content

Button Color effecting text alignment


Datus
 Share

Recommended Posts

Cant see whats wrong here but as soon as you set the color of the button the styles are ignored and text is placed at the top of the button.

Im probably using the wrong command to change color but tried it with built in code designer to make sure.

Any ideas?

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

GUICreate("My GUI Button")
$Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100,100,$BS_BOTTOM)
$Button_2 = GUICtrlCreateButton("Button Test", 10, 140, 100,100,$BS_BOTTOM)
GUICtrlSetBkColor(-1, 0x00ff00)
GUISetState() 
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd

not found anything on search.

We live as we dream alone!

Link to comment
Share on other sites

  • Moderators

Datus,

There are several bugs affecting coloured buttons - for example, there has been an open Trac ticket on them trapping Enter for about a year.

Best to avoid them if you can. :-)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

ive used a label instead.

still doesnt give exaclty the control i wanted but better than the button in present form.

wish they would spend some more time sorting out gui controls and settings rather than adding even more complicated functions.

spend more time trying work arrounds than coding these days. :)

But still i love Autoit and wouldnt be without it.

We live as we dream alone!

Link to comment
Share on other sites

i never use buttons anymore... labels are so much more customizable... i even use labels for my exit buttons and minimize buttons.. labels can be used for everything (that i know of) that a button can be used for

Link to comment
Share on other sites

Datus,

There are several bugs affecting coloured buttons - for example, there has been an open Trac ticket on them trapping Enter for about a year.

Best to avoid them if you can. :-)

M23

Perhaps this is really not a bug, but feature elements in Windows, because the button is created on the basis of a certain style (picture).
Link to comment
Share on other sites

one thing i want to do is put text from bottom up.

you cant do that with a label. or can you?

I don't think you can with a style, but you could arrange it by adding empty lines.

GUICreate("label text")
GUICtrlCreateLabel(@CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "   bottom",20,20,100,100)
GUICtrlSetBkColor(-1,0x006666)
GUICtrlSetColor(-1,0xFFFFFF)
GUISetState()

while GUIGetMsg() <> -3
    
WEnd

It depends on why you want it and what you want to do with the label though.

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

that fine if you know what your going to put in the label.

however i read a file with film names in which can be multiple words etc.

just as my example code shows at the start.

was just responding to comments made by codybarret

We live as we dream alone!

Link to comment
Share on other sites

there was a style that one of the MPV's mentioned a while back... i can't remember it off hand.. but ill look, maybe im remembering falsly.. in that case martin would be right.. GAHH its on the tip of my tounge :)

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