Jump to content

TabItem


DaLiMan
 Share

Recommended Posts

Hi,

I was trying to set the background color af a TabItem, but was unable to change it.

Am I doing it wrong or is it just not possible?

From the HELP-file:

#include <GUIConstants.au3>

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

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab=GUICtrlCreateTab (10,10, 200,100)
    ;
    ;Set background color !!! (won't work here...)
     GUICtrlSetBkColor(-1,0x00ff00) ; Green
    ;
    ;
$tab0=GUICtrlCreateTabitem ("tab0")
GUICtrlSetBkColor(-1,0x00ff00) ; Green
GUICtrlCreateLabel ("label0", 30,80,50,20)
$tab0OK=GUICtrlCreateButton ("OK0", 20,50,50,20)
$tab0input=GUICtrlCreateInput ("default", 80,50,70,20)

$tab1=GUICtrlCreateTabitem ( "tab----1")
GUICtrlCreateLabel ("label1", 30,80,50,20)
$tab1combo=GUICtrlCreateCombo ("", 20,50,60,40)
GUICtrlSetData(-1,"Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK=GUICtrlCreateButton ("OK1", 80,50,50,20)

$tab2=GUICtrlCreateTabitem ("tab2")
GUICtrlSetState(-1,$GUI_SHOW); will be display first
GUICtrlCreateLabel ("label2", 30,80,50,20)
$tab2OK=GUICtrlCreateButton ("OK2", 140,50,50)

GUICtrlCreateTabitem (""); end tabitem definition

GUICtrlCreateLabel ("label3", 20,130,50,20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Any ideas?

Link to comment
Share on other sites

include <GUIConstants.au3>
autoItSetOption("TrayIconDebug", 1)
; --------------------------------------------------------------
GUICreate("My GUI TAB color", 220, 160)
GuiSetBkColor (0x00E0FFFF)
GUISetFont (9, 300)

$button1=GUICtrlCreateTab (10,10, 200,100)

; TAB 0
$tab0=GUICtrlCreateTabitem ("tab#0")
; TAB 1
$tab1=GUICtrlCreateTabitem ("tab#1")
GuiCtrlSetState($tab1, 16); $GUI_SHOW
$lab1= GUICtrlCreateLabel (" Set me a color ", 92, 51, 90, 20)
$combo=GUICtrlCreateCombo ("", 20, 50, 70, 80)
GuiCtrlSetData (-1,"Red|Blue|Green")
$input1=GUICtrlCreateInput ("default", 20, 80,70,20)
GuiSetState (@SW_SHOW)

; Run the GUI until the dialog is closed or timeout
$start=TimerInit()
Do
$msg = GUIGetMsg()
if $msg <> 0 then $start=TimerInit()
if $msg>0 then
  If GUICtrlRead($combo) then
     $col= GUICtrlRead($combo)
     $_posw = WinGetPos("My GUI TAB")
     Select
        case $col= "Red"
           GUICtrlSetBkColor($lab1, 0xff0000)
           GuiSetBkColor( 0xff0000)
        case $col= "Blue"
           GUICtrlSetBkColor($lab1, 0xff)
           GuiSetBkColor( 0xff)
        case $col= "Green"
           GUICtrlSetBkColor($lab1, 0xff00)
           GuiSetBkColor( 0xff00)
        EndSelect
  EndIf
endif
Until $msg = $GUI_EVENT_CLOSE OR TimerDiff($start)>=3000

That's what you can do. :lmao:

Only Label, Checkox, Group, Radio, Treeview and Progress controls can currently be colored.

I am updating the doc on the subject.

Link to comment
Share on other sites

...Only Label, Checkox, Group, Radio, Treeview and Progress controls can currently be colored...

<{POST_SNAPBACK}>

Bacause of the fact that GUICtrlCreateList didn't like to be painted, some days I tested to paint

the TreeView- and the ListView-controls. I soon found out that ListView didn't support this and

that only TreeView-control did. That wasn't exactly what I wanted, so I'm wondering :

Is it possible, that in the future, it will be possible to paint ListView (..and List..) controls ?

Link to comment
Share on other sites

Bacause of the fact that GUICtrlCreateList didn't like to be painted, some days I tested to paint

the TreeView- and the ListView-controls. I soon found out that ListView didn't support this and

that only TreeView-control did. That wasn't exactly what I wanted, so I'm wondering :

Is it possible, that in the future, it will be possible to paint ListView (..and List..) controls ?

<{POST_SNAPBACK}>

I will do some research to find how that can be done. I already have a solution for Edit and input not supported in 3.1.0.

Stay tune :lmao:

Link to comment
Share on other sites

I will do some research to find how that can be done. I already have a solution for Edit and input not supported in 3.1.0.

Stay tune o:)

<{POST_SNAPBACK}>

Aaah, thanks for looking at it, jpm ! Great !

Edit and Input too ?? :lmao: Woohoo !

Another thing. I think this has been asked before but anyway :

How can you get the value of the selected item in a TreeView ?

If doing a GUICtrlRead on the TreeView you only get the control-id for the selected

item, and if going further with that information using another GUICtrlRead on that

control you'll only receive the state of it. Is it possible to get the value from this item

and not only the state ? Thanks !

Link to comment
Share on other sites

@Helge

You can make a 2 dimensional array.

In Array[$i][0] you could have the ctrl ID and in Array[$i][1] the name of the item.

Just a tip.

<{POST_SNAPBACK}>

Yes, that's one way of doing it but aren't there any more direct way of doing it ?

And easier... Hmm, I know there's an easier way ! Maybe a DLLCall ?

Argh, I'll figure it out.. :lmao:

Link to comment
Share on other sites

I searched the list of messages for something that returns the text.

I did not find any message that does that.

Here's where I searched:

http://msdn.microsoft.com/library/default....iew/reflist.asp

<{POST_SNAPBACK}>

Thanks for helping SlimShady !

I'll try to get something working when I get back home in Easter.

It would be cool if we were able to read the selected item in

TreeView and ListView, like we do with List...*hint hint* :lmao:

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