Sign in to follow this  
Followers 0
ileandros

GUISetBkColor Help??

16 posts in this topic

Hi there,

$List1 = GUICtrlCreateList("", 40, 35, 201, 110)
GUICtrlSetData(-1," ")
$Random = Random ('0x000000','0xFFFFFF')
GUISetBkColor ($Random)
$Random = Random ('10','20')
Sleep ($Random)

I'm trying to make this progg to have different colors and also i want the colors to change while i have the progg running.

I managed to get this far but i didn't realy made it.I have some different colors each time i open the progg.

Is there a way to make it change the colors while the progg is running???


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites



ileandros,

You could use an Ablib function to change the colour at regular intervals. :)

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

#3 ·  Posted (edited)

I already did it but i get an error. Let me show u my progg and check it!!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements




$hForm1 = GUICreate("", 674, 190, 195, 130)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,295,35,330,110)
$hButton1 = GUICtrlCreateButton("One", 295, 150, 50, 25)
$hButton3 = GUICtrlCreateButton("Two", 355, 150, 50, 25)
$hButton2 = GUICtrlCreateButton("Three", 40, 150, 80, 25)
$hButton4 = GUICtrlCreateButton("_Exit", 545, 150, 80, 25)
$List1 = GUICtrlCreateList("", 40, 35, 201, 110)
GUICtrlSetData(-1,"One | Two | Thee")
$Random = Random ('0x000000','0xFFFFFF')
GUISetBkColor ($Random)
$Random = Random ('10','20')
Sleep ($Random)
$hGroup1 = GUICtrlCreateGroup("Radio List", 24, 16, 230, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hGroup2 = GUICtrlCreateGroup("Browser", 280, 16, 365, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)

MsgBox(0, "Blocking", "Press me to continue") ; Just for test

GUISetState(@SW_SHOW)



While 1
WEnd

Try to add a func for it and if u can help me!

I didn't make it :/

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ileandros,

I see no Adlib function in that code - are you sure you tried? :)

M23

Edit: You might want to use GUICtrlSetBkColor rather than GUISetBkColor. ;)

Edited by Melba23
Added a suggestion

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)

I did it but i delete it because i used to get errors :/

I also get error with GUICtrlSetBkColor :/

This is just how my progg looks like/is.

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

ileandros,

Try this - it does not give me any errors: :)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <Color.au3>


Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

$hForm1 = GUICreate("", 674, 190, 195, 130)
;$oIE = _IECreateEmbedded()
;GUICtrlCreateObj($oIE, 295, 35, 330, 110)

$hButton1 = GUICtrlCreateButton("One", 295, 150, 50, 25)
$hButton3 = GUICtrlCreateButton("Two", 355, 150, 50, 25)
$hButton2 = GUICtrlCreateButton("Three", 40, 150, 80, 25)
$hButton4 = GUICtrlCreateButton("_Exit", 545, 150, 80, 25)

$Random = Random(0x000000, 0xFFFFFF, 1)
$List1 = GUICtrlCreateList("", 40, 35, 201, 110)
GUICtrlSetData(-1, "One | Two | Thee")
GUICtrlSetBkColor($List1, $Random)
$hGroup1 = GUICtrlCreateGroup("Radio List", 24, 16, 230, 170)
$hGroup2 = GUICtrlCreateGroup("Browser", 280, 16, 365, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

AdlibRegister("_Recolour", 1000)

While 1

    If GUIGetMsg() = -3 Then Exit

WEnd


Func _Recolour()
    $Random = Random(0x000000, 0xFFFFFF, 1)
    GUICtrlSetBkColor($List1, $Random)
    ; Get contrasting text colour
    If _ColorGetBlue($Random) < 0x50 Or _  ; Blue
        _ColorGetGreen($Random) < 0x50 Or _  ; Green
        _ColorGetRed($Random) < 0x50 Then  ; Red
        $iText = 0xFFFFFF
    Else
        $iText = 0x000000
    EndIf
    GUICtrlSetColor($List1, $iText)
EndFunc

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

Good Shot dude.That did it :DThank you.

I was trying to do the same for the entire progg but i didn't make it.

I tried the same thing as u did switch the $List with the $hForm1 but didn't manage to change the colours :/

Any tips. ? I managed to change the colour though but i cant make it keep changing :/


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

ileandros,

but i cant make it keep changing

Have you used the Adlib function? :)

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

#9 ·  Posted (edited)

Yes, i used ur function and switch the $List1 with the $hForm1. I guess that didn't do it.

It must be wrong written. :/

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

ileandros,

If you want the GUI to change colour then you need to change the GUICtrlSetBkColor lines into GUISetBkColor like this: :)

#include <buttonconstants.au3>
#include <guiconstantsex.au3>
#include <guilistbox.au3>
#include <windowsconstants.au3>
#include <ie.au3>
#include <color.au3>

Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

$hForm1 = GUICreate("", 674, 190, 195, 130)
$Random = Random(0x000000, 0xFFFFFF, 1)
GUISetBkColor($Random) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;$oIE = _IECreateEmbedded()
;GUICtrlCreateObj($oIE, 295, 35, 330, 110)

$hButton1 = GUICtrlCreateButton("One", 295, 150, 50, 25)
$hButton3 = GUICtrlCreateButton("Two", 355, 150, 50, 25)
$hButton2 = GUICtrlCreateButton("Three", 40, 150, 80, 25)
$hButton4 = GUICtrlCreateButton("_Exit", 545, 150, 80, 25)
$List1 = GUICtrlCreateList("", 40, 35, 201, 110)
GUICtrlSetData(-1, "One | Two | Thee")
$hGroup1 = GUICtrlCreateGroup("Radio List", 24, 16, 230, 170)
$hGroup2 = GUICtrlCreateGroup("Browser", 280, 16, 365, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

AdlibRegister("_Recolour", 1000)

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

Func _Recolour()
    $Random = Random(0x000000, 0xFFFFFF, 1)
    GUISetBkColor($Random) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
EndFunc

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

Yes this works. I'm not good at all at this :/

Whats the diff between GuiCTRLSetBkColor and GuiSetBkColor????

Thank you for ur help :)


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

Yes this works. I'm not good at all at this :/

Whats the diff between GuiCTRLSetBkColor and GuiSetBkColor????

Thank you for ur help :)

Don't you have the help file that came with the AutoIt 3 download? It would seem to be pretty obvious what the differences are once you read it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi ileandros. Run the example scripts in the help file for the two - you will see the difference immediately.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I just run the examples given from the download help files and i think i got the differencer but i guess im not that good at this program that's why im getting confused.

Anyway im gonna get better :)

Thanks all guys.


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

Hey guys besides than changing the color of the background can i also add images/icons or sth else as a background????


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

ileandros,

You can use an image as a background with GUICtrlCreatePic - but make sure you read the Remarks section of the Help file page very carefully. :)

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