caramen

GUI color wont be apply

21 posts in this topic

Hello all :)

I tryed in my script 2 methode to change the general GUI color but nothing happen...

If $readinputNUMPC = "Num_PC : OK" And $readinputUAC = "Etat UAC : UAC Désactivé!" And $readinputArchive = "Archivage auto : Activé" And $readinputArchive2 = "Cycle Jours : 14"  And $readinputArchive3 = "Cycle Mois : 2" And $readinputArchive4 = "Prompt : Désactivé" And $readinputArchive5 = "Old items : Moved"  And $readinputArchive6 = "Mailbox Items : Archiver"  Then
               GUICtrlSetBkColor( $hGui , 0x22B14C )
               GUISetBkColor(0x22B14C)
EndIf

All condition is OK but

GUICtrlSetBkColor( $hGui , 0x22B14C )
GUISetBkColor(0x22B14C)

does not change the color i do somthing whrong ?

Share this post


Link to post
Share on other sites



it s not a condition probleme becose look :

      Local $readinputNUMPC = GUICtrlRead ( $ScanNUMPC )
      Local $readinputUAC = GUICtrlRead ( $ScanUAC )
      Local $readinputArchive = GUICtrlRead ( $ScanArchivage )
      Local $readinputArchive2 = GUICtrlRead ( $ScanCycleJours )
      Local $readinputArchive3 = GUICtrlRead ( $ScanCycleMois )
      Local $readinputArchive4 = GUICtrlRead ( $ScanPrompt )
      Local $readinputArchive5 = GUICtrlRead ( $ScanOldItems )
      Local $readinputArchive6 = GUICtrlRead ( $ScanBoxITEM )

         If $readinputNUMPC = "Num_PC : N/A" Then
               GUICtrlSetBkColor( $ImageNUMPClabel , 0xFFC90E ) ;ORANGE
         ElseIf $readinputNUMPC = "Num_PC : Non config '000'" Then
               GUICtrlSetBkColor( $ImageNUMPClabel , 0x000000 ) ;Noir
         ElseIf $readinputNUMPC = "Num_PC : OK" Then
               GUICtrlSetBkColor( $ImageNUMPClabel , 0x22B14C ) ;VERT
         EndIf

         If $readinputUAC = "Etat UAC : UAC Activé!" Then
               GUICtrlSetBkColor( $ImageUAClabel , 0x000000 ) ;Noir
         ElseIf $readinputUAC = "Etat UAC : UAC Désactivé!" Then
               GUICtrlSetBkColor( $ImageUAClabel , 0x22B14C ) ;VERT
            EndIf

         If $readinputArchive = "Archivage auto : Activé" And $readinputArchive2 = "Cycle Jours : 14"  And $readinputArchive3 = "Cycle Mois : 2" And $readinputArchive4 = "Prompt : Désactivé" And $readinputArchive5 = "Old items : Moved"  And $readinputArchive6 = "Mailbox Items : Archiver"  Then
               GUICtrlSetBkColor( $ImageARCHIVElabel , 0x22B14C ) ;Vert
         ElseIf $readinputArchive = "Archivage auto: N/A" And $readinputArchive2 = "Cycle Jours : N/A"  And $readinputArchive3 = "Cycle Mois : N/A" And $readinputArchive4 = "Prompt : N/A" And $readinputArchive5 = "Old items : N/A"  And $readinputArchive6 = "Mailbox Items : N/A"  Then
               GUICtrlSetBkColor( $ImageARCHIVElabel , 0xFFC90E ) ;Orange
         Else
               GUICtrlSetBkColor( $ImageARCHIVElabel , 0x000000 ) ;Noir
         EndIf

         If $readinputNUMPC = "Num_PC : OK" And $readinputUAC = "Etat UAC : UAC Désactivé!" And $readinputArchive = "Archivage auto : Activé" And $readinputArchive2 = "Cycle Jours : 14"  And $readinputArchive3 = "Cycle Mois : 2" And $readinputArchive4 = "Prompt : Désactivé" And $readinputArchive5 = "Old items : Moved"  And $readinputArchive6 = "Mailbox Items : Archiver"  Then
               GUICtrlSetBkColor( $hGui , 0x22B14C )
               GUISetBkColor($hGUI,0x22B14C)
         EndIf

everything else is working exept last need

Share this post


Link to post
Share on other sites

; change this
GUICtrlSetBkColor( $hGui , 0x22B14C )

; to this
GUISetBkColor( $hGui , 0x22B14C )


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

Not working and i tryed two way to complet conditions.

;~       If $readinputNUMPC = "Num_PC : OK" And $readinputUAC = "Etat UAC : UAC Désactivé!" And $readinputArchive = "Archivage auto : Activé" And $readinputArchive2 = "Cycle Jours : 14"  And $readinputArchive3 = "Cycle Mois : 2" And $readinputArchive4 = "Prompt : Désactivé" And $readinputArchive5 = "Old items : Moved"  And $readinputArchive6 = "Mailbox Items : Archiver"  Then
         If $ImageARCHIVElabel = 0x22B14C And $ImageUAClabel = 0x22B14C And $ImageNUMPClabel = 0x22B14C Then
               GUISetBkColor( $hGui , 0x22B14C )
         EndIf

Share this post


Link to post
Share on other sites

Solved

Your GUISetBkColor syntax is not correct : the parameters are in the wrong order

 

thx

Share this post


Link to post
Share on other sites

ps this should be added in the help file ;)

Share this post


Link to post
Share on other sites

What should be in the help file? The syntax is already listed there, you just didn't read it correctly.

I also contributed to this by not checking the parameter order when I posted what I did, but I rarely use either function but should have known better. ;)


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

#10 ·  Posted (edited)

GUISetBkColor
Sets the background color of the GUI window.


GUISetBkColor ( background [, winhandle] )


Parameters
background Background color of the dialog box. 
winhandle [optional] Windows handle as returned by GUICreate() (default is the previously used window). 

Return Value
Success: 1. 
Failure: 0. 

Remarks
None.


Related
GUICreate() 
Example

Copy to clipboard #include <ColorConstantS.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    GUICreate("My GUI") ; will create a dialog box that when displayed is centered

    GUISetBkColor($COLOR_RED) ; will change background color

    GUISetState(@SW_SHOW) ; will display an empty dialog box

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    GUIDelete()
EndFunc   ;==>Example

This is the help file and there is no order specified

Not enouth explicit for noobs like me ;p

Edit: and the exemple script dont even show an order or even a color ID insteed of $COLOR_RED with that include.

The confusion for me is winhandle =/= ControlID in help file

My bad ?^^

Edited by caramen

Share this post


Link to post
Share on other sites

caramen,

 

This is the help file and there is no order specified

And what do you think this is:

GUISetBkColor ( background [, winhandle] )
if not an example of function syntax showing 2 parameters in a specific order? :huh:

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

Nvm my english is not good enouth to explain what i dont get in this exemple :D

Forget this. Thx for help ;)

Share this post


Link to post
Share on other sites

Alors explique-le en Français. On devrait se comprendre entre nous...

Dac :) ba enfaite je pensé que le winhandle été comme pour le winmove une sorte de titre de fenêtre au lieu d'un control ID d’où ma confusion.

Je voulais également dire que la méthode de choix de couleur n’était pas assez explicite dans le helpdoc pour les gents qui débute comme moi... car il y a une include qui n'est pas explicité alors qu'elle n'a pas de rapport avec le call de la GUI color bien que le sujet reste la couleur j’entends bien.

Mais j'ai bien compris que le problème venait de moi ;) c'est pourquoi je préfère m’écraser :P

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

caramen,

Compris - je vais peutetre changer l'exemple pour le clarifier. ;)

 

je pensé que le winhandle été comme pour le winmove une sorte de titre de fenêtre au lieu d'un control ID

Make sure you understand the difference between a handle and a ControlID:

 

- A handle is a unique ID given by Windows to everything - GUIS, controls, etc.

- A ControlID is a value used by the app (or AutoIt itself) to identify the control.

Any control created by a GUICtrlCreate* function returns an AutoIt controlID which is an index to an internal array listing all the native controls. A GUI, or a control created by a UDF, returns a handle. You can get the actual Windows handle from the AutoIt ControlID by using GUICtrlGetHandle - going the reverse way is more complicated and has very little application. Clearer? :huh:

M23

Edit:

Summary: caramen feels the use of a constant for the colour in the Help file example was confusing. I will look at changing it. He was also confused by the handle/ControlID/ duality. :)

Edited by Melba23

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

#17 ·  Posted (edited)

Wow Melba23 thx man for that explaination. This is exactly the kind of informations that i need to improve myself in autoit.

I dont expected so much moderation members are frenchs :D I feel like happy ;p

And... I realy like the fact to trying improve the autoit help file even with my low skills xD this is realy cool. Thx for listenning to me ;)

Edited by caramen

Share this post


Link to post
Share on other sites

caramen,

 

so much moderation members are frenchs

Je suis un anglais quasiment bilangue, pas francais du tout! :P

Do you know that there is a French language forum? :huh:

M23

Trad: I am a nearly bilingual Englishman - not French at all!


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

caramen,

 

Je suis un anglais quasiment bilangue, pas francais du tout! :P

Do you know that there is a French language forum? :huh:

M23

Trad: I am a nearly bilingual Englishman - not French at all!

Unfortunatly i got a bad experience in french forums. I realy prefer this forum for some reason...

1) More users here. 

2) Answer faster here. 

3) Skills better here.

4) I prefer official forum.

5) I want improve my english xD (if you watch all my first post you will see it's what i am doing :P )

6) etc... :D

Share this post


Link to post
Share on other sites

Caramen, you forgot to say that you don't want to use the french forum because we said you that the french forum does not help users with game automation. That is your own choice.

Nobody prevents you to come and ask questions that follow the rules (as here).

Even if the French community is less active than here, many quality-members provide answers every day.

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