PureCOLOR library : coloring gadgets (and much more)

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

Moderator: gnozal

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 v15.00 (PB 4.40 version)

Changes :
- split library in 3 parts (menus, buttons, the rest of the gadgets)
  So you have a smaller footprint if you don't use all functions.
- new functions (user request) : PureCOLOR_SetIcon[Toggle]Button()
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 v15.02 (PB 4.40 version)

Changes :
- fixed window icon menu / popup icon menu coexistence issue posted by iostream (finally)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

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

Post by Rook Zimbabwe »

Having issue clearing button colors... will try new DL and see if that is the fix!

Nope:

look...

Code: Select all


Enumeration
  #Window_0
EndEnumeration

Enumeration
  #Button_8
  #Button_7
  #Button_6
  #Button_5
  #Button_4
  #Button_3
  #Button_2
  #Button_1
  #Button_0
  #Text_MSG
EndEnumeration

Structure VisualDesignerGadgets
  Gadget.l
  EventFunction.l
EndStructure

Global NewList EventProcedures.VisualDesignerGadgets()
;-
Procedure Whichbutton(button)
  For XX = #Button_8 To #Button_0
    PureCOLOR_ClearButtonColor(XX)
  Next
  PureCOLOR_SetButtonColor(button, RGB(255, 255, 255), RGB(0, 0, 0))
EndProcedure
;-
Procedure Button_8_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_8)
EndProcedure

Procedure Button_7_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_7)
EndProcedure

Procedure Button_6_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_6)
EndProcedure

Procedure Button_5_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_5)
EndProcedure

Procedure Button_4_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_4)
EndProcedure

Procedure Button_3_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_3)
EndProcedure

Procedure Button_2_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_2)
EndProcedure

Procedure Button_1_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_1)
EndProcedure

Procedure Button_0_Event(Window, Event, Gadget, Type)
  Whichbutton(#Button_0)
EndProcedure
;-
Procedure RegisterGadgetEvent(Gadget, *Function)
  
  If IsGadget(Gadget)
    AddElement(EventProcedures())
    EventProcedures()\Gadget        = Gadget
    EventProcedures()\EventFunction = *Function
  EndIf
  
EndProcedure

Procedure CallEventFunction(Window, Event, Gadget, Type)
  
  ForEach EventProcedures()
    If EventProcedures()\Gadget = Gadget
      CallFunctionFast(EventProcedures()\EventFunction, Window, Event, Gadget, Type)
      LastElement(EventProcedures())
    EndIf
  Next
  
EndProcedure
;-
Procedure Open_Window_0()
  
  If OpenWindow(#Window_0, 5, 5, 248, 441, "BUTON TESTER",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
    
    ButtonGadget(#Button_0, 5, 5, 235, 40, "BUTTON 0")
    RegisterGadgetEvent(#Button_0, @Button_0_Event())
    ButtonGadget(#Button_1, 5, 50, 235, 40, "BUTTON 1")
    RegisterGadgetEvent(#Button_1, @Button_1_Event())
    ButtonGadget(#Button_2, 5, 95, 235, 40, "BUTTON 2")
    RegisterGadgetEvent(#Button_2, @Button_2_Event())
    ButtonGadget(#Button_3, 5, 140, 235, 40, "BUTTON 3")
    RegisterGadgetEvent(#Button_3, @Button_3_Event())
    ButtonGadget(#Button_4, 5, 185, 235, 40, "BUTTON 4")
    RegisterGadgetEvent(#Button_4, @Button_4_Event())
    ButtonGadget(#Button_5, 5, 230, 235, 40, "BUTTON 5")
    RegisterGadgetEvent(#Button_5, @Button_5_Event())
    ButtonGadget(#Button_6, 5, 275, 235, 40, "BUTTON 6")
    RegisterGadgetEvent(#Button_6, @Button_6_Event())
    ButtonGadget(#Button_7, 5, 320, 235, 40, "BUTTON 7")
    RegisterGadgetEvent(#Button_7, @Button_7_Event())
    ButtonGadget(#Button_8, 5, 365, 235, 40, "BUTTON 8")
    RegisterGadgetEvent(#Button_8, @Button_8_Event())
    TextGadget(#Text_MSG, 5, 410, 235, 25, "", #PB_Text_Center | #PB_Text_Border)
    
  EndIf
EndProcedure
;-
Open_Window_0()

PureCOLOR_SetButtonColor(#Button_0, RGB(255, 255, 255), RGB(0, 0, 0))

Repeat
  
  Event  = WaitWindowEvent()
  Gadget = EventGadget()
  Type   = EventType()
  Window = EventWindow()
  
  Select Event
  Case #PB_Event_Gadget
    CallEventFunction(Window, Event, Gadget, Type)
    
  EndSelect
  
Until Event = #PB_Event_CloseWindow

End

This code SHOULD uncolor all the buttons and then slap the color on the selectted button... instead it simply colors the new button as well... :(

Using PureCOLOR_ClearAllButtonColors() is not an option in my program as I have MANY buttons in my POS... in PB4.3 this code works... I suspect it is a PB4.41 issue!



The latest version I could download fromyour site was 15.03
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

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

Post by DoubleDutch »

On PureBasic v4.50b2 I get polink errors. They refer to unsolved external symbols 'pb_callfunctionfast', 'pb_callfunctionfast7' an 'pb_callfunctionfast4'.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

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

Post by Rook Zimbabwe »

OK with a little help from a tiny bit of code from eesau I have used the API to reset colors in a proceedure.

I changed the following procedure:

Code: Select all

Procedure Whichbutton(button)

cbutface = GetSysColor_ ( #COLOR_BTNFACE ) ; API for theme button FACE color
cbuttext = GetSysColor_ ( #COLOR_BTNTEXT) ; API for theme button TEXT color
  
  For XX = #Button_8 To #Button_0
   ;PureCOLOR_ClearButtonColor(XX)
   PureCOLOR_SetButtonColor(XX, cbuttext, cbutface) ; use those raw values to recolor the button
  Next

 ; PureCOLOR_ClearAllButtonColors() 
  PureCOLOR_SetButtonColor(button, RGB(255, 255, 255), RGB(0, 0, 0))
EndProcedure
I am worried about memory leaks... I may try to set button text and face myself... Maybe even a rounded button! (Ala VB4!)

@DoubleDutch... LIB isn't optimizeed for 4.5 yet! I suspect the new draw functions are to blame for some of our issues!
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
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 »

Rook Zimbabwe wrote:Having issue clearing button colors... will try new DL and see if that is the fix!
The latest version I could download from your site was 15.03
I will have a look.
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 v15.04 (PB 4.40 version)

Changes :
- fixed cleared buttons not being refreshed (a global variable got lost when I split the library).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

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

Post by Rook Zimbabwe »

So would my fix :

Code: Select all

  cbutface = GetSysColor_ ( #COLOR_BTNFACE )
  cbuttext = GetSysColor_ ( #COLOR_BTNTEXT)
  
  For XX = #Button_0 To #Button_8
    PureCOLOR_ClearButtonColor(XX)
    PureCOLOR_SetButtonColor(XX, cbuttext, cbutface) 
  Next
just create more images and clutter memory?

ALSO

You need to make a DONATION link on your website... I use PureCOLOR and I intend to pay you for it!!! I am probaly going to use pureFORM soon as I am becoming dissatisfied with the current VD!!! You need to make that a purchase thing... $10.00 or more!!! :D

Yrretti wrote you do a lot of good works for PB and I wholly agree!!! 8)
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
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 »

Rook Zimbabwe wrote:So would my fix ... just create more images and clutter memory?
No, PureCOLOR_ClearButtonColor() clears the allocated resources.
Anyway, a simple refresh (like RedrawWindow_()) would have been enough.
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 »

I have have just recompiled the library for PB 4.50 beta 4
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

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

Post by dige »

gnozal wrote:I have have just recompiled the library for PB 4.50 beta 4
thank you! works fine with pb4.50 B4 now :-)
"Daddy, I'll run faster, then it is not so far..."
rnospam
New User
New User
Posts: 7
Joined: Fri Nov 13, 2009 10:33 pm

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

Post by rnospam »

I am using PureColor 4.5B4 and the Option Gadgets are not setting the Front Color.

PureColor_SetGadgetColor(#Option1, $FFFFFF, #Blue)

Sets the Background, but not the ForeGound(Text)

Thanks
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 »

rnospam wrote:I am using PureColor 4.5B4 and the Option Gadgets are not setting the Front Color.
PureColor_SetGadgetColor(#Option1, $FFFFFF, #Blue)
Sets the Background, but not the ForeGound(Text)
Thanks
This works here :

Code: Select all

OpenWindow(0, 100, 300, 400, 200, "PureCOLOR test", #PB_Window_SystemMenu) 
OptionGadget(1, 10, 10, 90, 20, "OptionGadget")
PureCOLOR_SetGadgetColor(1, RGB(255,0,0), RGB(0,0,255))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Tested on WinXP (no skins)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
rnospam
New User
New User
Posts: 7
Joined: Fri Nov 13, 2009 10:33 pm

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

Post by rnospam »

OpenWindow(0, 100, 300, 400, 200, "PureCOLOR test", #PB_Window_SystemMenu)
OptionGadget(1, 10, 10, 90, 20, "OptionGadget")
PureCOLOR_SetGadgetColor(1, RGB(255,0,0), RGB(0,0,255))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Does not work, I am using Windows 7, 64Bit, PureBasic 4.5Beta4 32Bit. Aero Theme.

Text Color is always black.

Thanks..

Rnospam
rnospam
New User
New User
Posts: 7
Joined: Fri Nov 13, 2009 10:33 pm

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

Post by rnospam »

Update.. Also Does not work with checkbox gadgets

PB 4.41 and PureColor Version 15.03 work great.

Rnospam
Post Reply