PureCOLOR library : coloring gadgets (and much more)
Moderator: gnozal
PureColor and disabled buttons
Hello,
in my application I have two buttons which are normally disabled. In this state the button text can be seen. But this is true only when the system colors are used. When I set the text color to another value, the color of the button surface changes to dark gray and the text can't be seen anymore.
In this state the gadget remains even when I set it back to system colors.
in my application I have two buttons which are normally disabled. In this state the button text can be seen. But this is true only when the system colors are used. When I set the text color to another value, the color of the button surface changes to dark gray and the text can't be seen anymore.
In this state the gadget remains even when I set it back to system colors.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureColor and disabled buttons
Yes, disabled colored buttons don't look very nice. It's because colored buttons are in reality imagebuttons, and PureCOLOR would have to draw another image if the button is disabled...drahneir wrote:When I set the text color to another value, the color of the button surface changes to dark gray and the text can't be seen anymore.
Two workarounds :
- hide the buttons instead of disabling them
- clear the colors for disabled buttons : they will look like normal disabled buttons
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
When I say clear colors, I mean use PureCOLOR_ClearGadgetColor() and not setting system colors.drahneir wrote:I have edited my mail, perhaps you haven't seen the last sentence.
When the button is set back to system colors, the disabled button keeps its ugly appearance.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Hi, Gnozal.
I think I may have found a bug (maybe not).
In the above code, the second text gadget is not redrawn correctly (at least on my machine). Is this a normal behaviour?
Thanks for such wonderful contributions.
I think I may have found a bug (maybe not).
Code: Select all
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 320, 200, "test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
TextGadget(0, 50, 50, 200, 20, "this is a normal text gadget")
TextGadget(1, 50, 100, 200, 20, "this is a text gadget with PureCOLOR")
ButtonGadget(2, 50, 150, 100, 20, "Click here")
EndIf
EndIf
PureCOLOR_SetGadgetColor(1, RGB(0,0,100), #PureCOLOR_DontSetBackColor)
Repeat
wEvent = WaitWindowEvent(10)
Select wEvent
Case #PB_Event_CloseWindow
Fim = #True
Case #PB_Event_Gadget
Select EventGadget()
Case 2
SetGadgetText(0, "this text was changed correctly!")
SetGadgetText(1, "this text was not changed correctly!")
EndSelect
EndSelect
Until Fim
In the above code, the second text gadget is not redrawn correctly (at least on my machine). Is this a normal behaviour?
Thanks for such wonderful contributions.
Proud registered Purebasic user.
Because programming should be fun.
Because programming should be fun.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
It's an expected behaviour as you have defined #PureCOLOR_DontSetBackColor as backcolor : this makes the gadget transparent, so it doesn't erase the previous text.byo wrote:Hi, Gnozal.
I think I may have found a bug (maybe not).
In the above code, the second text gadget is not redrawn correctly (at least on my machine). Is this a normal behaviour?
Here is a workaround :
Code: Select all
...
Select EventGadget()
Case 2
SetGadgetText(0, "this text was changed correctly!")
SetGadgetText(1, "this text was not changed correctly!")
RedrawWindow_(WindowID(0), 0, 0, #RDW_ERASE | #RDW_FRAME | #RDW_INVALIDATE | #RDW_ALLCHILDREN )
EndSelect
...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (all PB versions)
Changes :
- menu functions rewritten : the old functions are gone, replaced by new ones. New feature : icon support.
See PureCOLOR_Test_13.pb for a code example.
Changes :
- menu functions rewritten : the old functions are gone, replaced by new ones. New feature : icon support.
See PureCOLOR_Test_13.pb for a code example.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Gnozal,
with that workaround, I'm seeing some flickering when all the window is being updated. Is there a way to update only the region of the textgadget reducing the flcikering?
I'm using:
to capture the textgadget's rect. How can I update only this rect using the RedrawWindow procedure?
Thanks a lot for the effort you put into your userlibs/code.
with that workaround, I'm seeing some flickering when all the window is being updated. Is there a way to update only the region of the textgadget reducing the flcikering?
I'm using:
Code: Select all
GetWindowRect_(GadgetID(0), rect)
Thanks a lot for the effort you put into your userlibs/code.
Proud registered Purebasic user.
Because programming should be fun.
Because programming should be fun.
It's not working here:
Unless there's something else to be done or I'm doing something wrong.
Thanks for the fast reply.
Code: Select all
SetGadgetText(#txDicas, dica)
InvalidateRect_(WindowID(#wMain), rect, #True)
Thanks for the fast reply.
Proud registered Purebasic user.
Because programming should be fun.
Because programming should be fun.
Well, I'm not really sure what you're doing but, if I was just wishing to re-paint a text gadget I would probably (though not always) use :
You may need to add :
It all depends on what you're trying to do? If it is to stop flicker when updating the main window then you can try setting the #WS_CLIPCHILDREN style bit of the main window etc. There are all kinds of tricks to employ when attempting to reduce flicker and it all depends on individual circumstances whether any single 'trick' will make any difference etc.
Code: Select all
InvalidateRect_(GadgetID(#txtGadget), 0, #TRUE)
Code: Select all
UpdateWindow_(GadgetID(#txtGadget))
I may look like a mule, but I'm not a complete ass.
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: PureCOLOR library : coloring gadgets (and much more)
> PB4.1x : http://freenet-homepage.de/gnozal/PureCOLOR__.zip
Link doesn't work. And neither does the 4.1x link on your home page at
http://freenet-homepage.de/gnozal/ .
Link doesn't work. And neither does the 4.1x link on your home page at
http://freenet-homepage.de/gnozal/ .
