Jump to content

Label over etched frame in TabItem - problem


Mungo
 Share

Recommended Posts

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
Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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