Page 1 of 1

Problems with Pure Color and WindowCallback

Posted: Thu Sep 01, 2005 9:30 pm
by PB&J Lover
I am trying to use the PureColor library and I am having a problem. If I include this line in my WindowCallBack() I get muted buttons.

Here's the code:

Code: Select all

Procedure WindowCallback(WindowID,Message,wParam,lParam)
  ReturnValue = #PB_ProcessPureBasicEvents
  ;ReturnValue = PureCOLOR_CallBack(WindowID, Message, wParam, lParam, ReturnValue) ; <-------- add this line in your window callback

  If Message = #WM_GETMINMAXINFO
    ReturnValue = PVDynamic_LockWindow(WindowID,lParam)
  EndIf
  
  If Message = #WM_SIZE
    ReturnValue = PVDynamic_Resize(WindowID)
  EndIf

  If Message = #WM_CTLCOLORSTATIC Or Message=#WM_CTLCOLOREDIT Or Message=#WM_CTLCOLORLISTBOX
    ReturnValue = PVDynamic_ColorGadget(lParam,wParam)
  EndIf

  ProcedureReturn ReturnValue
EndProcedure
If I uncomment the ReturnValue line at the top I get coloring but muted buttons. I've used this other way of changing the colors on my listicongadget:

Code: Select all

SendMessage_(GadgetID(Gadget_pickboard_data),#LVM_SETBKCOLOR,0,colorBKG)
SendMessage_(GadgetID(Gadget_pickboard_data),#LVM_SETTEXTBKCOLOR,0,colorBKG)
SendMessage_(GadgetID(Gadget_pickboard_data),#LVM_SETTEXTCOLOR,0,colorTXT
and it works, but it is not as nice as the one line Pure Colors. Also I can't use the other Pure Colors stuff.

Any ideas?

Finally, no matter which method I use, there is a textgadget that is colored every other time I open the window with the listicongadget on it. What's up with that?

Thanks. PB is the best!

Posted: Fri Sep 02, 2005 8:18 am
by gnozal
I don't own PureVISION, so I can't test your code.
But :

For coloring, PureCOLOR uses the #WM_CTLCOLOR* messages ; PureVISION also !

So in your example, the #WM_CTLCOLOR* messages are handled by PVDynamic_ColorGadget(), wich is called after PureCOLOR_CallBack() in your callback procedure.

You have to use PureCOLOR or PVDynamic_ColorGadget() for gadget coloring, but not both, as they may handle the same messages.

Perhaps you could use PureCOLOR for the coloring, and the PVDynamic stuff for the rest (except coloring). Is there something you can do with PVDynamic_ColorGadget() you can't with PureCOLOR ?

Pure Color problem

Posted: Fri Sep 02, 2005 2:12 pm
by PB&J Lover
gnozal wrote:Is there something you can do with PVDynamic_ColorGadget() you can't with PureCOLOR ?
I don't know. But that gives me a place to start. Thanks. :D

Any idea what is causing my textgadget to change color every other time it is opened? Could it be the same message problem?

Thanks again.