Jump to content

Problems with Graphic in a tab


HaavY
 Share

Recommended Posts

I need a graphic control in a tabitem, but it just wont show up. It works if I don't use tabs, but when I added tabs only the button below it showed up.

CODE
GuiCtrlCreateTab(2, 1, 299, 285)

GuiCtrlCreateTabItem("The Tab")

$Color_Field = GUICtrlCreateGraphic(100, 30, 100, 100)

GUICtrlSetBkColor($Color_Field, 0xffffff)

$Click = GUICtrlCreateButton("Start", 125, 150, 50, 30)

Oh and by the way this is not the entire code, I have more tabs (which are currently empty) and of course a GuiCtrlCreateTabItem("") to end the tabitem creation.

I think the problem is that the tab goes in front of the graphic control, how do I fix this?

[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Link to comment
Share on other sites

I need a graphic control in a tabitem, but it just wont show up. It works if I don't use tabs, but when I added tabs only the button below it showed up.

CODE
GuiCtrlCreateTab(2, 1, 299, 285)

GuiCtrlCreateTabItem("The Tab")

$Color_Field = GUICtrlCreateGraphic(100, 30, 100, 100)

GUICtrlSetBkColor($Color_Field, 0xffffff)

$Click = GUICtrlCreateButton("Start", 125, 150, 50, 30)

Oh and by the way this is not the entire code, I have more tabs (which are currently empty) and of course a GuiCtrlCreateTabItem("") to end the tabitem creation.

I think the problem is that the tab goes in front of the graphic control, how do I fix this?

;modified from Example of TAB in TAB ctrl by aec in AutoIt post
#include <GUIConstants.au3>

Global $main_GUI,$ok_button,$cancel_button

;This window has 2 ok/cancel-buttons
$main_GUI       = GUICreate("TAB in TAB",260,250,-1,-1)
$ok_button      = GUICtrlCreateButton("OK",40,220,70,20)
$cancel_button  = GUICtrlCreateButton("Cancel",150,220,70,20)

; Create the first child window that is implemented into the main GUI
$child1         = GUICreate("",230,170,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)
$child_tab      = GUICtrlCreateTab(10,10,210,150)
$child11tab     = GUICtrlCreateTabItem("1")
$child12tab     = GUICtrlCreateTabItem("2")
GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI
$child2         = GUICreate("",230,170,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)
$labBkGround        =  GUICtrlCreateLabel("",0,0,230,170,$WS_CLIPSIBLINGS);GUICtrlCreateListView("Col1|Col2",10,10,210,150,-1,$WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1,0xff0000)
GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlCreateGraphic(20, 80, 34,64, $SS_SUNKEN)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetState(-1, $GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xff04ff)

; Switch back the main GUI and create the tabs
GUISwitch($main_GUI)
$main_tab       = GUICtrlCreateTab(10,10,240,200)
$child1tab      = GUICtrlCreateTabItem("Child1")
$child2tab      = GUICtrlCreateTabItem("Child2")
GUICtrlCreateTabItem("")

GUISetState()
$HideShow = $GUI_HIDE + $GUI_SHOW
$chil1tabstate = true

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $cancel_button
            $chil1tabstate = not $chil1tabstate
            If $chil1tabstate Then
              GUISetState(@SW_ENABLE,$child2)
              Else
               GUISetState(@SW_DISABLE ,$child2)
              EndIf
                  
        Case $main_tab
            Switch GUICtrlRead($main_tab)
                Case 0
                  GUISetState(@SW_HIDE,$child2)
                  GUISetState(@SW_SHOW,$child1)
          
                Case 1
                  GUISetState(@SW_HIDE,$child1)
                  If $chil1tabstate Then GUISetState(@SW_SHOW,$child2)
            EndSwitch
    EndSwitch
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

All I really had to do was adding GUICtrlSetState(-1, 2048) after it, you did not need to post the entire script, but thanks anyways.

Works! Yay

[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Link to comment
Share on other sites

All I really had to do was adding GUICtrlSetState(-1, 2048) after it, you did not need to post the entire script, but thanks anyways.

Works! Yay

Glad you figured out what was needed.

I posted the whole script because it was an example I had which seemed to do what you wanted but I was too lazy to find out which bit you needed so I posted it all. :)

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