Jump to content
Sign in to follow this  
killaz219

Button Color

Recommended Posts

Gary,

Thanks for the user-friendly rgb feature. It fits with my other programs. :(

I've attached an example script that draws 12 buttons.

I am unsure why only the first 7 are visible when I run this script.

The other 5 buttons appear if you click on their area one at a time.

Or all 5 appear if you hit the Tab key.

Any ideas? :think:

taurus905

Nadda, looks like a job for Holger


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Nadda, looks like a job for Holger

I did find a work-around. (If you can call it that.)

Send a Tab and a Shift-Tab after GUISetState()

so it looks like this:

GUISetState()

Send("{TAB}")

Send("+{TAB}")

Not very elegant, :think: but it works. :(

Edited: I take that back. It doesn't work right.

If you minimize the window, the buttons disappear and you need to click or tab each one again in order for them to become visible.

taurus905

Edited by taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

GUISetState()

Send("{TAB}")

Send("+{TAB}")

Edited: I take that back. It doesn't work right.

If you minimize the window, the buttons disappear and you need to click or tab each one again in order for them to become visible.

1) try to use some API instead of Send() for example SendMessage Invalidate() for buttons or something similar (InvalidateRect)...

2) at minimize/restore problem can help GUIRegisterMsg(WM_DRAW) (or some other?) and do Invalidate for buttons

Share this post


Link to post
Share on other sites

I think msgs are being dropped because there is too much code for each msg and the code takes too long to process... But, I could be sooooo wrong.

LAr.

Larry,

I was thinking the same thing. Too long to process. I guess a solution would be to cut down on the code or use some sort of wait feature. Any ideas?

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

1) try to use some API instead of Send() for example SendMessage Invalidate() for buttons or something similar (InvalidateRect)...

2) at minimize/restore problem can help GUIRegisterMsg(WM_DRAW) (or some other?) and do Invalidate for buttons

Zedna,

Couldyou provide an example to your suggestions 1 and/or 2?

I am not sure what you mean. I think I stayed up too late and I need some more sleep.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

Zedna,

Couldyou provide an example to your suggestions 1 and/or 2?

I am not sure what you mean. I think I stayed up too late and I need some more sleep.

taurus905

I didn't try this toolbar only looked at sources.

So it was only ideas for give you a thought about possible ways to solve problems.

I can't help more precisely at this time as I do know it exactly myself :think:

Maybe somtetimes later when I try it and play with it bit more ...

Share this post


Link to post
Share on other sites

Example for Invalidate is in my radar_src.zip, see my signature...

$pic_hWnd = ControlGetHandle("Radar","Velikost = ",$pic)
DLLCall("user32.dll","int","InvalidateRect","hwnd",$pic_hWnd,"int",0,"int",0); bErase=False

So you can this way post InvalidateRect message to these toolbar buttons

either in WM_DRAW or in WM_PAINT function which you register by GUIRegisterMsg()

That's my idea :think:

Share this post


Link to post
Share on other sites

Example for Invalidate is in my radar_src.zip, see my signature...

$pic_hWnd = ControlGetHandle("Radar","Velikost = ",$pic)
DLLCall("user32.dll","int","InvalidateRect","hwnd",$pic_hWnd,"int",0,"int",0); bErase=False

So you can this way post InvalidateRect message to these toolbar buttons

either in WM_DRAW or in WM_PAINT function which you register by GUIRegisterMsg()

That's my idea :think:

Zedna,

Thanks for your input on this problem.

It is my hope that your idea can be applied by someone with more knowledge than I possess.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

But why impliment owner drawn buttons when you can create your own?

And why use AutoIt when you can use C++?! :">

It is of course a matter of simplicity. I use AutoIt because it usually lets me do a lot of neat stuff with very little effort. If I need to start writing tens of lines of coude just to color a button then the whole purpose of using AutoIt becomes kind of moot...

I just believe that this is such a basic thing, used in so many programs that it should either be included as an official UDF or, preferably, as a built-in feature of AutoIt.

Angel

Share this post


Link to post
Share on other sites

Gary,

Thanks for the user-friendly rgb feature. It fits with my other programs. :(

I've attached an example script that draws 12 buttons.

I am unsure why only the first 7 are visible when I run this script.

The other 5 buttons appear if you click on their area one at a time.

Or all 5 appear if you hit the Tab key.

Any ideas? :think:

taurus905

I would really like to do my part in solving this problem, as opposed to just complaining and expecting others to do all the work. I really love AutoIt and feel that by digging deeper I will gain a better understanding in order to help other users. You can't truly help others without helping yourself.

Here is my request from advanced users or developers, such as gafrost and Holger, who have both been very helpful already.

Can you please suggest areas of study (keywords I can google, or links) that will provide background and possible clues to the hows and whys of setting and changing button colors?

At this point, it is my guess that as the 12_button.au3 example stands, that this is a timing issue and may be resolved by some type of delay. It may not be the best solution, but I just want to get it to work first, before tweaking it further.

I have some experience with Visual Basic 2005 Express Edition and realize the answer may be a VB issue.

Thanks to all who can help point me in the right direction.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

already know how to treat labels as buttons, what we are looking for is a resolution to the GUIRegisterMsg problem(s)


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I just make bitmaps all the time.

Manadar,

I too made bitmaps for my buttons. But I would like my flexibility in resizing the buttons and having the color remain across the entire surface. With bitmaps, when you make the button larger the bitmap doesn't grow with it. Plus I would like to use different sizes and types of fonts.

I am patiently waiting for Holger and gafrost to work out the GUIRegisterMsg issue. I wish I could help them, but I don't know enough, yet.

The colored labels looked good, but didn't work for me because I need a context menu for each button. I was wondering if it were possible to overlay a transparent button on top of a colored label.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

Manadar,

I too made bitmaps for my buttons. But I would like my flexibility in resizing the buttons and having the color remain across the entire surface. With bitmaps, when you make the button larger the bitmap doesn't grow with it. Plus I would like to use different sizes and types of fonts.

I am patiently waiting for Holger and gafrost to work out the GUIRegisterMsg issue. I wish I could help them, but I don't know enough, yet.

The colored labels looked good, but didn't work for me because I need a context menu for each button. I was wondering if it were possible to overlay a transparent button on top of a colored label.

taurus905

Disclaimer:

I have never written anything in AU3 before and I haven't even tried the 12_buttons.au3 demo yet because I can't find some include file GuiButton.au3...

However I see that you haved tried to use a bitmat and it rang with something I have ran into before. I have been down that road with my code in the past... My solution then was to make a 2 layer gui. Create the first one with buttons and then make it slightly transparent. Then I would use the same coordinates for everything, but at 100% filled progress bars with he color of my choosing. It worked really great. Then you can just specify width & height for buttons, spacing, the number of buttons, where to break for a new row and set colors for each to automatically generate everything on the fly. I definitely need color buttons to stay focused with my ADHD, so I'll find something that works in AU3.

Share this post


Link to post
Share on other sites

I definitely need color buttons

The buttons already can be colored :P - Just use GuiCtrlSetBkColor()...

But the problem with this, is that the buttons are not looks like buttons, they just like label with frame :) - and i mean they not looks like pushable.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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  

×
×
  • Create New...