Page 31 of 35

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

Posted: Mon Feb 22, 2010 11:00 am
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()

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

Posted: Wed Feb 24, 2010 9:55 am
by gnozal
Update v15.02 (PB 4.40 version)

Changes :
- fixed window icon menu / popup icon menu coexistence issue posted by iostream (finally)

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

Posted: Tue Mar 30, 2010 7:54 pm
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

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

Posted: Fri Apr 02, 2010 11:39 am
by DoubleDutch
On PureBasic v4.50b2 I get polink errors. They refer to unsolved external symbols 'pb_callfunctionfast', 'pb_callfunctionfast7' an 'pb_callfunctionfast4'.

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

Posted: Fri Apr 02, 2010 5:15 pm
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!

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

Posted: Wed Apr 07, 2010 12:34 pm
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.

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

Posted: Wed Apr 07, 2010 2:20 pm
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).

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

Posted: Wed Apr 07, 2010 4:37 pm
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)

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

Posted: Thu Apr 08, 2010 10:41 am
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.

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

Posted: Tue May 11, 2010 2:49 pm
by gnozal
I have have just recompiled the library for PB 4.50 beta 4

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

Posted: Tue May 11, 2010 2:54 pm
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 :-)

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

Posted: Fri May 21, 2010 4:28 pm
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

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

Posted: Fri May 21, 2010 4:45 pm
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)

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

Posted: Fri May 21, 2010 6:16 pm
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

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

Posted: Fri May 21, 2010 6:20 pm
by rnospam
Update.. Also Does not work with checkbox gadgets

PB 4.41 and PureColor Version 15.03 work great.

Rnospam