Page 32 of 35
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Sat May 22, 2010 7:52 am
by gnozal
rnospam wrote:PB 4.41 and PureColor Version 15.03 work great.
That's interesting.
I removed some theme inactivation code as it runned ok in WinXP + Themes.
Could you check the code below ?
Code: Select all
Procedure DisableXPTheme(GadgetNumber.l)
Protected UxTheme.l, SetWindowTheme.l
UxTheme = OpenLibrary(#PB_Any, "UxTheme.dll")
If UxTheme
SetWindowTheme = GetFunction(UxTheme, "SetWindowTheme")
If SetWindowTheme
CallFunctionFast(SetWindowTheme, GadgetID(GadgetNumber), @null.w, @null.w)
EndIf
CloseLibrary(UxTheme)
EndIf
EndProcedure
OpenWindow(0, 100, 300, 400, 200, "PureCOLOR test", #PB_Window_SystemMenu)
CheckBoxGadget(1, 10, 10, 90, 20, "CheckBoxGadget 1")
OptionGadget(3, 10, 160, 300, 30, "OptionGadget 3")
If OSVersion() > #PB_OS_Windows_XP
DisableXPTheme(1)
DisableXPTheme(3)
EndIf
PureCOLOR_SetGadgetColor(1, RGB(255,0,0), #White)
PureCOLOR_SetGadgetColor(3, RGB(255,0,0), #White)
;
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Mon May 24, 2010 3:38 pm
by rnospam
That works,
Thanks!
Rodger NoSpam
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Tue May 25, 2010 9:38 am
by gnozal
rnospam wrote:That works,
Thanks!
Rodger NoSpam
Ok, I will add this workaround in the next version.
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Tue May 25, 2010 4:14 pm
by rnospam
Just tested that Latest Version..
It works as expected, thanks for your support!.
Rodger NoSpam
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Fri Jun 11, 2010 10:13 pm
by GeBonet
Hello
I just upload all
the fresh version PureBasic 4.5 ... No apparent problem!
As with each version, I load and test a series of examples in various bookstores!
Petzold, Srod, Gdiplus, and necessarily WxWiget.Lib Gnozal Lib ...
And the "
PureColor-450-Installer.exe" so I assume for PB 4.50 ...
The example below gives me the following message :
[ERREUR] Invalid memory access. (read error at address 4)
Note:
Tested in 4.41, 4.40 no problem!
Code: Select all
; --------------------------------------------------------
; PureCOLOR library test file 15
; --------------------------------------------------------
;
DataSection
ButtonIcon:
IncludeBinary #PB_Compiler_Home + "Examples\Sources\Data\CdPlayer.ico"
EndDataSection
Button_Icon = CatchImage(#PB_Any, ?ButtonIcon)
Button_Icon_2 = Button_Icon
If OpenWindow(0, 421, 13, 270, 362, "Icon Button Test", #PB_Window_SystemMenu|#PB_Window_TitleBar)
ButtonGadget(0, 35, 45, 200, 35, "Centered text")
PureCOLOR_SetIconButton(0, #Green, #PureCOLOR_SystemColor, Button_Icon) ; <<< ICI === HERE
ButtonGadget(1, 35, 85, 200, 35, "Centered text")
PureCOLOR_SetIconToggleButton(1, #Green, #Black, #Red, #White, Button_Icon, Button_Icon_2); <<< ICI === HERE
ButtonGadget(2, 35, 135, 200, 35, "Left text", #PB_Button_Left)
PureCOLOR_SetIconButton(2, #Blue, #PureCOLOR_SystemColor, Button_Icon)
ButtonGadget(3, 35, 185, 200, 35, "Right text", #PB_Button_Right)
PureCOLOR_SetIconButton(3, #Blue, #PureCOLOR_SystemColor, Button_Icon)
ButtonGadget(4, 35, 235, 200, 35, "Icon button with" + Chr(10) + "multiline text", #PB_Button_MultiLine)
PureCOLOR_SetIconButton(4, #Blue, #PureCOLOR_SystemColor, Button_Icon)
ButtonGadget(5, 35, 285, 200, 35, "Button with" + Chr(10) + "multiline text", #PB_Button_MultiLine)
PureCOLOR_SetButtonColor(5, #Blue, #PureCOLOR_SystemColor)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = 0
CloseWindow(0)
Break
EndIf
EndSelect
ForEver
EndIf
; --------------------------------------------------------------------
Note : The other example involving an extension in PureColor produce the same effect!
For example:
PureCOLOR_SetGadgetColor (1, RGB (255,0,0), -1)
OK
PureCOLOR_SetGadgetColorEx (2, RGB (0,0,0), RGB (255, 255, 255), RGB (255, 255, 223), #PureCOLOR_LV_AlternateColors) NOT OK
Maybe it's not compatible???

But why this name:
PureColor-450
A + +

I also especially placed this message on the French forum !
Using Colour in the Graphical User Environment
Posted: Tue Jun 15, 2010 9:52 pm
by nigel
As someone who is new to Purebasic, there appear to be significant limitations in the
application of colour to GUI objects in the Purebasic environment, particularly
for buttons and panel gadgets. In this regard, I find these limitations difficult to
understand and have a few questions....
Am I correct in assuming that everyone uses the Purecolor library because support
for colour in Purebasic itself has significant limitations ?
I am a little confused because the Purecolor author recommends against using
this library wherever possible. It seems to me that it would be difficult to use
Purebasic for any significant development effort without using the Purecolor library.
Am I right in thinking that almost all experienced Purebasic programmers use this
library ?
As a side comment, I find the Purebasic help documentation to be very difficult
to follow for new users. This is mainly because the documentation consistently fails
to adequately define or explain parameters clearly. A good example of this can
be seen when looking at examples depicting the application of colour in Menu and
Gadget items.
Any comments would be appreciated.
Re: Using Colour in the Graphical User Environment
Posted: Wed Jun 16, 2010 12:46 am
by IdeasVacuum
Hello Nigel
The Pure Basic Forms Designer is relatively new, so there are a few things that could be better and surely will be in the future. However, it's a great little tool for graphically defining the layout of gadgets on a form, the 'scheme' for want of a better description. It is then a trivial matter to enhance the appearance by editing the code.
On the Windows platform, much of the colourisation of gadgets is dependent on whether or not your forms are to inherit the XP style, which does bring about limitations. However, for buttons, you can use a bitmap to deliver the colour if required ('ButtonImageGadget'). Gadgets such as text boxes ('StringGadget') can be customized with 'SetGadgetColor' and 'SetGadgetFont' etc - it's all in the help pages and could not be easier to code.
http://www.purebasic.com/documentation/ ... color.html
Re: Using Colour in the Graphical User Environment
Posted: Wed Jun 16, 2010 7:00 pm
by nigel
Hello IdeasVacuum
Thanks for your comments. It is valuable for new users (like me) to receive feedback from others like yourself
even if it is only to confirm that I am not missing something fundamental.
I had initially tried the visual designer that is included with Purebasic but had since found Pureform
from Gnozal, which (so far) I like better. Pureform appears to have good colour support included, although
this seems to need the Purecolor library which is not recommended by its author (Gnozal).
I assume the recommendation to avoid using Purecolor is because it is not natively supported by
Purebasic and therefore might be a future liability of some sort.
I did not realise that the standard Purebasic visual designer was relatively new. Perhaps this
explains why it has no significant colour support even though this is a surprising deficiency.
It is unfortunate that the native Purebasic colour support is not already built into the
visual design tools.
It had occurred to me that I could use images to colour certain gadgets and your suggestion
confirms that perhaps this would be a better approach instead of using Purecolor. Also the
existence of both Microsoft Vista and Win 7 already made me unlikely to think about using XP
style inheritance.
Thanks again for your valuable guidance. It is much appreciated.
gnozal - Question about Purecolor
Posted: Thu Jun 17, 2010 8:39 pm
by nigel
I am new to Purebasic and have been trying out your PureForm product which
I prefer in comparison to the Visual design tool included as standard with Purebasic.
I am particularly interested in knowing the reason you generally recommend
against using Purecolor, as this seems to be the only satisfactory way to
use colour in Panel and Button gadgets. So far I have been very surprised
at the poor level of colour support included within Purebasic and I see
Purecolor as a good solution to this deficiency even if it does involve using
an external library.
I have noted with interest that using Purecolor in the Pureform environment
to colour panel and button gadgets causes interface elements of Pureform
to inherit the same colours. Is this due to rigidities of the "class" concept ?
Any comments would be appreciated.
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Tue Jun 22, 2010 10:22 am
by gnozal
GeBonet wrote:I just upload all
the fresh version PureBasic 4.5 ... No apparent problem!
As with each version, I load and test a series of examples in various bookstores!
Petzold, Srod, Gdiplus, and necessarily WxWiget.Lib Gnozal Lib ...
And the "
PureColor-450-Installer.exe" so I assume for PB 4.50 ...
The example below gives me the following message :
[ERREUR] Invalid memory access. (read error at address 4)
No error here, even with purifier enabled.
However, I will recompile all librairies with PB4.50 final.
GeBonet wrote:Note : The other example involving an extension in PureColor produce the same effect!
For example:
PureCOLOR_SetGadgetColor (1, RGB (255,0,0), -1)
OK
PureCOLOR_SetGadgetColorEx (2, RGB (0,0,0), RGB (255, 255, 255), RGB (255, 255, 223), #PureCOLOR_LV_AlternateColors) NOT OK
No problems here with #PureCOLOR_LV_AlternateColors using PureCOLOR_TEST.pb.
Re: gnozal - Question about Purecolor
Posted: Tue Jun 22, 2010 10:25 am
by gnozal
nigel wrote:I have noted with interest that using Purecolor in the Pureform environment
to colour panel and button gadgets causes interface elements of Pureform
to inherit the same colours. Is this due to rigidities of the "class" concept ?
Yes, it is.
Some PureCOLOR functions use the SetClassLong() API (panels and containers iirc).
I may change this in the future.
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Tue Jun 22, 2010 9:38 pm
by nigel
gnozal
Thanks for your answer on the interface colouring issue.
I am still interested in understanding your reasons for recommending
against the use of Purecolor. Is it just because it involves an external
library and because you think the Purebasic author may eventually
improve colour support natively within the language itself ?
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Tue Jun 22, 2010 10:29 pm
by GeBonet
Tanks for the reply...
No error here, even with purifier enabled.
However, I will recompile all librairies with PB4.50 final.
I just reload bookstores and apparently it works ...

Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Wed Jun 23, 2010 10:43 am
by gnozal
nigel wrote:I am still interested in understanding your reasons for recommending against the use of Purecolor. Is it just because it involves an external library and because you think the Purebasic author may eventually improve colour support natively within the language itself ?
I am not recommending not to use PureCOLOR (I use it myself), but to use PB genuine functions whenever it's possible.
Several reasons :
- PureCOLOR does not support themes (it could have better support for themes, but it would be a lot of work and I am not using themes anyway, so...)
- some PB gadgets are not 100% Windows API compatible, so using an external library for coloring may have some unexpected results : the listicon grid lines issue, the combobox coloring not working when #PB_ComboBox_Image is used, ....
I don't think the PB authors will improve color support a lot because most users use themes, and they have 3 OS to support. But I may be wrong.
PureFORM uses PureCOLOR internally because it's an old app written with PB3.9x which had absolutely no color support at the time, nor icon menus.
However, in the generated code, you can choose between PureCOLOR and the genuine SetGadgetColor() function, and this for every class. It may not be supported by PB though.
Re: PureCOLOR library : coloring gadgets (and much more)
Posted: Wed Jun 23, 2010 7:11 pm
by SoS
Hi gnozal
PureColor is not working in threadsafe mode.(winxp 32)
I get "unresolved external.... _PB_Stringbase".