Jump to content

Background color of a group


Blastradius
 Share

Recommended Posts

Simple, hopefully.

How do i set the background color of the internal area of a group?

$Group = GUICtrlCreateGroup( "", 5, 0, 640, 495 )
GUICtrlSetBkColor ( $Group , 0x000000 )

I don't think it is so simple unless someone can say how, at least in XP windows sets the groups to have the window colour I think.

I would add a child window with a style $WS_POPUP and make it the size of the group, set its colour to the background colour you want for the group and put the group on the child window.

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

Simple, hopefully.

How do i set the background color of the internal area of a group?

This is a simple way
#include <GUIConstants.au3>
GUICreate("My GUI group", 300, 280)  ; will create a dialog box that when displayed is centered

$iBkClr = 0xFFFFA8
GUICtrlCreateInput("", 150, 66, 100, 134)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateGroup ("", 150, 60, 100, 140)
$radio_1 = GUICtrlCreateRadio ("Radio 1", 160, 90, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 160, 120, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group
GUISetState ()       ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Link to comment
Share on other sites

This is a simple way

#include <GUIConstants.au3>
GUICreate("My GUI group", 300, 280)  ; will create a dialog box that when displayed is centered

$iBkClr = 0xFFFFA8
GUICtrlCreateInput("", 150, 66, 100, 134)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateGroup ("", 150, 60, 100, 140)
$radio_1 = GUICtrlCreateRadio ("Radio 1", 160, 90, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 160, 120, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group
GUISetState ()       ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
That's good picaxe. The corners of the group are not rounded, but it works better with a label.

#include <GUIConstants.au3>
#include <windowsconstants.au3>
GUICreate("My GUI group", 300, 280) ; will create a dialog box that when displayed is centered

$iBkClr = 0xFFFFA8
;GUICtrlCreateInput("", 120, 66, 100, 134)
GUICtrlCreateLabel("",150,66,100,134)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateGroup ("abcdef", 150, 60, 100, 140)
$radio_1 = GUICtrlCreateRadio ("Radio 1", 160, 90, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 160, 120, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group
GUISetState ()    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
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

Hi, Another way to fake a group so you have rounded corners is use a disabled button

#include <GUIConstants.au3>
GUICreate("My GUI group", 300, 280)  ; will create a dialog box that when displayed is centered

$iBkClr = 0xFFFFA8
GUICtrlCreateButton("", 150, 60, 100, 140)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlSetState(-1, $GUI_DISABLE)

$radio_1 = GUICtrlCreateRadio ("Radio 1", 160, 90, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 160, 120, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)

GUISetState ()       ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
:)
Link to comment
Share on other sites

@smashly - Great idea, looks much better

@Martin - I didn't like the label text disrupting the group boundary line. Should probably be more like this

#include <GUIConstants.au3>
GUICreate("My GUI group", 300, 280)  ; will create a dialog box that when displayed is centered

$iBkClr = 0xFFFFA8
GUICtrlCreateButton("", 150, 60, 100, 140)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateLabel("Some Text", 166, 62, 65, 20)
GUICtrlSetFont(-1, 8, 600, 0)
GUICtrlSetColor(-1, 0x000080)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_1 = GUICtrlCreateRadio ("Radio 1", 170, 100, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 170, 130, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)

GUISetState ()       ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Link to comment
Share on other sites

@Martin - I didn't like the label text disrupting the group boundary line.

No, I didn't like it either. Maybe this is better.

#include <GUIConstants.au3>
#include <windowsconstants.au3>
GUICreate("My GUI group", 300, 280); will create a dialog box that when displayed is centered

$iBkClr = 0xFFFFA8
GUICtrlCreateLabel("",150,58,100,141)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup ("", 150, 52, 100, 148)
GUICtrlCreateGroup ("",-99,-99,1,1);close group
GUICtrlCreateGroup ("", 150, 60, 100, 140)
$radio_1 = GUICtrlCreateRadio ("Radio 1", 160, 90, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 160, 120, 60, 20)
GUICtrlSetBkColor(-1, $iBkClr)
GUICtrlCreateGroup ("",-99,-99,1,1);close group
GUICtrlCreateLabel(" group 1 ",158,60,45,18)
GUICtrlSetBkColor(-1,$iBkClr)
GUISetState ()   ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
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

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