Mungo Posted May 15, 2010 Posted May 15, 2010 (edited) This has probably been solved somewhere but I can't get it solved. Maybe someone can give me a hint. Within a tabitem I have created a label as a etched frame. I then superimpose another label with some text as a description of that area. If I use this in a non-tab window the second text label hides the etched frame only displaying the text and not the etched frame underneath for the length of that label. However, within the tabitem the etched frame shines through. How to avoid this? Any idea? GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME) GUICtrlCreateLabel("Display details:", 14, 40, 80, 18) As a work around I thought of grabbing the pixel color before, then draw another label of the same size as the text setting the background color to the pixel color and draw another label on top with the text again ... Thanks Edited May 15, 2010 by Mungo
picea892 Posted May 15, 2010 Posted May 15, 2010 GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME) GUICtrlCreateLabel("Display details:", 14, 40, 80, 18) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Mungo Posted May 15, 2010 Author Posted May 15, 2010 Thanks, ... hmm, that's what I tried before and just now again and it does not work for me. What I want is that the edged frame does not 'shine' through. By the way, the problem only appears within tabs ...
Fire Posted May 15, 2010 Posted May 15, 2010 (edited) Hi. If i understand correct this should be sample for you.(May be i`m wrong because my English Bad and i translate this topic with Google Translater. Sorry for any inconvience) expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("", 633, 447,-1,-1) $Tab1 = GUICtrlCreateTab(0, 0, 95, 22) ;This is our Tab GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Tab1") ;place here your more stuff.It will display only in this tabsheet1 $Label1=GUICtrlCreateLabel("LABEL: 1", 14, 40, 80, 18) $TabSheet2 = GUICtrlCreateTabItem("Tab2") ;;place here your more stuff.It will display only in this tabsheet2 GUICtrlSetState(-1,$GUI_SHOW) GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME) $labeltabitem2=GUICtrlCreateLabel("Display details:", 14, 40, 80, 18) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 Switch(GUICtrlRead($Tab1)) Case 0 ;tabitem1 ;somethink Case 1 ;tabitem 2 ;do somethink EndSwitch EndSwitch WEnd Edited May 15, 2010 by Fire [size="5"] [/size]
Mungo Posted May 17, 2010 Author Posted May 17, 2010 (edited) Hi. If i understand correct this should be sample for you.(May be i`m wrong because my English Bad and i translate this topic with Google Translater. Sorry for any inconvience) Thanks Fire for your reply and the code example. To give you an idea what I mean I have included some lines in your code basically producing a second no-tab-window. If you compare the <Tab2> window and the new <NO Tab> window you can see the difference and what I mean. In the <NO Tab> window the line of the edged frame is not visible behind the text " Display details: ". That's the way I would like to have it but only in a Tab window ... ;-) Thanks - any idea? expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("", 600, 400,-1,-1) $Tab1 = GUICtrlCreateTab(0, 0, 95, 22) ;This is our Tab GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Tab1") ;place here your more stuff.It will display only in this tabsheet1 $Label1=GUICtrlCreateLabel("LABEL: 1", 14, 40, 80, 18) $TabSheet2 = GUICtrlCreateTabItem("Tab2") ; place here your more stuff.It will display only in this tabsheet2 GUICtrlSetState(-1,$GUI_SHOW) ; ------- tab - example GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME) $labeltabitem2=GUICtrlCreateLabel("Display details:", 20, 34, 80, 18) $button_no_tab = GUICtrlCreateButton("See NO Tab version", 20, 360) ; display a popup without tab GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button_no_tab GUICreate("NO Tab", 220, 350,-1,-1) ; ------- NO tab - example GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME) GUICtrlCreateLabel(" Display details: ", 20, 34, 80, 18) GUICtrlCreateLabel("In comparinson to <Tab2>," & @LF _ & "the edged frame does not" & @LF _ & "shine through ""Display details: """, 30, 80) GUISetState(@SW_SHOW) Case $Tab1 Switch(GUICtrlRead($Tab1)) Case 0 ;tabitem1 ;somethink Case 1 ;tabitem 2 ;do somethink EndSwitch EndSwitch WEnd Edited May 17, 2010 by Mungo
therks Posted May 17, 2010 Posted May 17, 2010 (edited) That does seem very strange, seems like the label is forced to have the transparent background colour when it's in a tab. As a workaround though, you can just set the background colour of the label to the system background colour and that should work. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPI.au3> GUICreate('Hi!', 200, 200) GUICtrlCreateTab(0, 0, 200, 200) GUICtrlCreateTabItem('Hello') GUICtrlCreateLabel('', 50, 50, 100, 100, $SS_ETCHEDFRAME) GUICtrlCreateLabel(' Oh no!', 75, 45, 40, 15) GUICtrlSetBkColor(-1, _ColorFlip(_WinAPI_GetSysColor($COLOR_3DFACE))) ; _ColorFlip is necessary because GetSysColor returns the color in BGR format, we need it in RGB format. GUISetState() While 1 $gm = GUIGetMsg() Switch $gm Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _ColorFlip($iColor) Return BitAND(BitShift($iColor, -16) + BitAND($iColor, 0xFF00) + BitShift($iColor, 16), 0xFFFFFF) EndFunc Edit: Just an afterthough, but looking at what you're replicating here, is there any chance you could just use GUICtrlCreateGroup to do what you're looking for? The look is remarkably similar. Edited May 17, 2010 by therks My AutoIt Stuff | My Github
Mungo Posted May 17, 2010 Author Posted May 17, 2010 That does seem very strange, seems like the label is forced to have the transparent background colour when it's in a tab. As a workaround though, you can just set the background colour of the label to the system background colour and that should work......Edit: Just an afterthough, but looking at what you're replicating here, is there any chance you could just use GUICtrlCreateGroup to do what you're looking for? The look is remarkably similar.Great and many thanks! ... creating a group is of course so much simpler ... and works just as fine. I am fairly new and I simply never stumbled upon it. Thanks for the _ColorFlip function hint.Cheers
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now