Problems with Pure Color and WindowCallback

Windows specific forum
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Problems with Pure Color and WindowCallback

Post 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!
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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 ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Pure Color problem

Post 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.
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
Post Reply