Panel gadget with highlighted tabs

Windows specific forum
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> can I see a screenshot of what you get with my original code without my last fix. ?

Here's what the original code looks like.

Left image is when first run. Green tabs look okay, without the line, but that's
only because the green box covers it. I don't want/need a colored background;
I only want to change the text color.

Right image is after I click the middle tab, and it has the line as you can see.

Image
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Will it work to your specifications if you use the panel color for the fillrect command?

cheers
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

@rsts: Good thinking! 8)

I just replaced greenBrush = CreateSolidBrush_(#Green) with
greenBrush = CreateSolidBrush_(GetSysColor_(#COLOR_3DFACE))
and it works perfectly now!

Thanks to Sparkie and yourself for all your help. :D
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Sorry PB, I misunderstood which line you were referring to. :oops:

Thanks rsts for your helping hand. I've applied your fix to my original code. ;)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

One last thing, Sparkie. :?

The text on the deselected tabs are not centered vertically properly; they are
too high. See the two images above, where "Panel 3" in both images is too
close to the top of the tab? Do you know how to fix that? I know it's to do
with a RECT structure but can't figure out how to set it, and perhaps drop
the #DT_VCENTER flag too?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

PB, try adding this just before each DrawText_()...

Code: Select all

*PGdis\rcItem\top + 3
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> *PGdis\rcItem\top + 3

Thanks man! I was trying *PGdis.rcItem\top+3 which was failing. It didn't
occur to me that I could use 2 x \ in there, I thought it was a syntax error.

Now this fixes the non-selected tabs, but the selected one is too low. But,
I think I can fix this one myself. ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I think I can fix this one myself

Worked it out! :) It's done like this:

Code: Select all

If *PGdis\itemID<>GetGadgetState(PGNumber)
  *PGdis\rcItem\top+3
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply