Jump to content
Sign in to follow this  
Mungo

Label over etched frame in TabItem - problem

Recommended Posts

Mungo

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 by Mungo

Share this post


Link to post
Share on other sites
picea892

GUICtrlCreateLabel("", 10, 40, 200, 300, $SS_ETCHEDFRAME)
GUICtrlCreateLabel("Display details:", 14, 40, 80, 18)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

Share this post


Link to post
Share on other sites
Mungo

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

Share this post


Link to post
Share on other sites
Fire

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)

#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 by Fire

[size="5"] [/size]

Share this post


Link to post
Share on other sites
Mungo

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?

#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 by Mungo

Share this post


Link to post
Share on other sites
therks

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 by therks

Share this post


Link to post
Share on other sites
Mungo

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

Thanks for the _ColorFlip function hint.

Cheers

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.