PureCOLOR library : coloring gadgets (and much more)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Thanks for advertising
:lol:
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

New version compiled with PB4.40 beta 1 : http://freenet-homepage.de/gnozal/PureCOLOR_440.zip
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
magicjo
User
User
Posts: 61
Joined: Sun May 07, 2006 10:43 am
Location: Italy

Post by magicjo »

@gnozal,
if i compile in threadsafe mode the example module "PUREColor_Test.pb", i obtain the error "unresolved external symbol _PBStringBasePosition" : can you verify ?
PB Registered User, Egrid Registered User
Win7 x64 Ultimate, 4,00 Gb Mem, Ati Radeon HD4600 Series, Realtek High Definition Audio Integrated
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Post by Kurzer »

Did you set the Subsystem "UserLibThreadSafe" in the compiler-prefs?
I stumbled over the same issue after enabling the threadsafe-mode in the compiler options.
magicjo
User
User
Posts: 61
Joined: Sun May 07, 2006 10:43 am
Location: Italy

Post by magicjo »

thanks kurzer.
I usually use Japbe and there's not need to set the subsystem. :wink:
PB Registered User, Egrid Registered User
Win7 x64 Ultimate, 4,00 Gb Mem, Ati Radeon HD4600 Series, Realtek High Definition Audio Integrated
superloupiot
New User
New User
Posts: 3
Joined: Sat Jan 02, 2010 3:11 pm

Problem with PureCOLOR

Post by superloupiot »

Hi,

I'm new to the use of PureBasic (3 days ago).
I've started to use it and quiclky came to the point where I would like to change the background color a the button gadget.

Apparently, the PureCOLOR library authorizes that feature.
Hence, I have installed the PureCOLOR library version 4.4.
When I try to compile the example code PureCOLOR_Test.pb, I get the following error message:

POLINK:fatal error: Corrupt library:.\PureCOLOR_Lib_14.lib

I'm working under Windows7 - 64 bit.
The version of PureBasic is 4.40 (x64)
The version of PureCOLOR is 4.40 : PureCOLOR_440.zip

Could some one help me here?

Thanks.
superloupiot
New User
New User
Posts: 3
Joined: Sat Jan 02, 2010 3:11 pm

Re: Problem with PureCOLOR

Post by superloupiot »

OK, I have remove the 64-bit version of PureBasic and installed the32-bit version.
I can observe that on my computer, PureCOLOR work with the 32-bit version but not with the 64-bit version.
superloupiot
New User
New User
Posts: 3
Joined: Sat Jan 02, 2010 3:11 pm

Button gadget and multiline flag

Post by superloupiot »

Hello,

When the Button_MultiLine flag is set and when a PureColor is applied to the button gadget, the background color is as expected but the text background color is white.

Is there a way to change the text background color to the same color as the button background color.

Here after is the code that shows the problem.

Thanks.
  • ;{- Enumerations / DataSections
    ;{ Windows
    Enumeration
    #Window_0
    EndEnumeration
    ;}
    ;{ Gadgets
    Enumeration
    #Button_0
    EndEnumeration
    ;}
    Define.l Event, EventWindow, EventGadget, EventType, EventMenu
    ;}
    Procedure OpenWindow_Window_0()
    If OpenWindow(#Window_0, 450, 200, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    ButtonGadget(#Button_0, 100, 75, 160, 135, "Gadget_0", #PB_Button_MultiLine)
    ; Gadget Colors
    PureCOLOR_SetButtonColor(#Button_0, #PureCOLOR_SystemColor, $FF, #PureCOLOR_SystemColor, $8080FF)
    EndIf
    EndProcedure

    OpenWindow_Window_0()

    ;{- Event loop
    Repeat
    Event = WaitWindowEvent()
    Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
    EventGadget = EventGadget()
    EventType = EventType()
    If EventGadget = #Button_0
    EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
    EventWindow = EventWindow()
    If EventWindow = #Window_0
    CloseWindow(#Window_0)
    Break
    EndIf
    EndSelect
    Forever
    ;
    ;}
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Problem with PureCOLOR

Post by gnozal »

superloupiot wrote:OK, I have remove the 64-bit version of PureBasic and installed the32-bit version.
I can observe that on my computer, PureCOLOR work with the 32-bit version but not with the 64-bit version.
Yes, all my apps / libs / tools are 32bits (x86) only.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Button gadget and multiline flag

Post by gnozal »

Congratulations !
You found a bug.
I am using API functions for multiline buttons, and these functions and PB's '2DDrawing' library don't mix well since PB4.40.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureCOLOR library : coloring gadgets (and much more)

Post by gnozal »

Update v14.06 (PB4.40 version)

Changes :
- this build should fix the multiline button issue posted by superloupiot
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
mx101
User
User
Posts: 73
Joined: Thu Sep 18, 2008 3:21 pm

Re: PureCOLOR library : coloring gadgets (and much more)

Post by mx101 »

hi gnozal

if you can help me.
how to set SystemColor color to Frame3DGadget like PureColor without use the PureColor Lib?


i use x64 and PureColor not support x64.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureCOLOR library : coloring gadgets (and much more)

Post by gnozal »

To set colors without PureCOLOR, this should work I guess (tested on XP x86 (themes disabled)) :

Code: Select all

Global textBackground = CreateSolidBrush_(#red)
Global textForeground = #White

Procedure WinProc(hwnd,msg,wParam,lParam) 
  result = #PB_ProcessPureBasicEvents 
  If msg=#WM_CTLCOLORSTATIC And lParam=GadgetID(1) 
    SetBkMode_(wParam, #TRANSPARENT) 
    SetTextColor_(wParam, textForeground)
    result = textBackground 
  EndIf 
  ProcedureReturn result 
EndProcedure 

OpenWindow(0,0,0,200,100,"Frame3DGadget Color",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
Frame3DGadget(1,20,20,150,70,"Some text") 
SetWindowCallback(@WinProc()) 

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 

DeleteObject_(textBackground)
Some other code : http://www.purebasic.fr/english/viewtopic.php?t=24919
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
mx101
User
User
Posts: 73
Joined: Thu Sep 18, 2008 3:21 pm

Re: PureCOLOR library : coloring gadgets (and much more)

Post by mx101 »

gnozal wrote:To set colors without PureCOLOR, this should work I guess (tested on XP x86 (themes disabled)) :

Code: Select all

Global textBackground = CreateSolidBrush_(#red)
Global textForeground = #White

Procedure WinProc(hwnd,msg,wParam,lParam) 
  result = #PB_ProcessPureBasicEvents 
  If msg=#WM_CTLCOLORSTATIC And lParam=GadgetID(1) 
    SetBkMode_(wParam, #TRANSPARENT) 
    SetTextColor_(wParam, textForeground)
    result = textBackground 
  EndIf 
  ProcedureReturn result 
EndProcedure 

OpenWindow(0,0,0,200,100,"Frame3DGadget Color",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
Frame3DGadget(1,20,20,150,70,"Some text") 
SetWindowCallback(@WinProc()) 

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 

DeleteObject_(textBackground)
Some other code : http://www.purebasic.fr/english/viewtopic.php?t=24919
Big thanks gnozal :D
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: PureCOLOR library : coloring gadgets (and much more)

Post by Kurzer »

Aloha Gnozal,

I found a strange bug using PureColor and font-enabling for gadgets.
Try this code please:
(PB 4.40 final, PureColour 4.40, downloaded today)

Code: Select all

  Window_Main = OpenWindow(#PB_Any, 200, 200, 300, 60, "Test", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_TitleBar|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget)
  If Window_Main
    SmartWindowRefresh(Window_Main, #True)
    
    TestButton1 = ButtonGadget(#PB_Any, 10, 10, 135, 40, "Long long long text", #PB_Button_MultiLine)
    TestButton2 = ButtonGadget(#PB_Any, 155, 10, 140, 40, "Long long long text", #PB_Button_MultiLine)

    PureRESIZE_SetGadgetResize(TestButton1, 1, 0, 0, 1)
    PureRESIZE_SetGadgetResize(TestButton2, 1, 0, 0, 1)

    SetGadgetFont(TestButton1, LoadFont(0, "Arial", 8, 272))
    SetGadgetFont(TestButton2, LoadFont(1, "Arial", 8, 272))

    PureCOLOR_SetButtonColor(TestButton1, #PureCOLOR_SystemColor, $18A784)
    PureCOLOR_SetButtonColor(TestButton2, #PureCOLOR_SystemColor, $20B3B7)
  EndIf

	DisableGadget(TestButton1, 1)
	DisableGadget(TestButton2, 1)

	Repeat
	
		Delay (10)
		i+1
		
		If i = 100
			DisableGadget(TestButton1, 0)
			DisableGadget(TestButton2, 0)
		ElseIf i = 200
			DisableGadget(TestButton1, 1)
			DisableGadget(TestButton2, 1)
			i=0
		EndIf
	  
	Until WindowEvent() = #PB_Event_CloseWindow
I wannt to colour the buttons background and set a bold font for the button text.
All went okay. but if I disable and re-enable the buttons then a wrong fontsize/font will be displayed.

As you can see in the example above, in disabled mode the fontsize is correct. but after enabling the buttons the size is too big.

The code is extracted from a PureForm generated code, so no "manual" coding in the example except of some minor adjustments. If it's a logicallly failure, then PureFORM generate wrong code I guess.

Can you help me quickly with this problem? My current development/release stops because of this issue.

Thank you very much in advance.

Edit: It's not a PureBasic bug, because if you comment out the two PureCOLOR lines, then the bug does not appear.

Code: Select all

;     PureCOLOR_SetButtonColor(TestButton1, #PureCOLOR_SystemColor, $18A784)
;     PureCOLOR_SetButtonColor(TestButton2, #PureCOLOR_SystemColor, $20B3B7)
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
Post Reply