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 »

i see, i will try find some code that works okay on pre-xp machines, maybe someone reading this thread may also have some info.
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 »

Library update

Small fix
- PureCOLOR_SetPopupMenuBackColor() now also works correctly with standard menus
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:

Post by gnozal »

DoubleDutch wrote:i see, i will try find some code that works okay on pre-xp machines, maybe someone reading this thread may also have some info.
Ok, I have some code wich works well on Win9x, but not on WinNT4. As PureCOLOR_SetPopupMenuBackColor() don't work with NT4 either, I will add some owner drawn menu functions to the next library version.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

gnozal - thanks a lot for the great libraries. I was looking for a way to color individual lines in listicons but had quite a bit of trouble getting it to work correctly with callbacks. Worked but not well. Your lib saved me a lot of time :D I'm also using your purelvsort library for another project. Very nice.

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

Post by gnozal »

Xombie wrote:gnozal - thanks a lot for the great
Thanks 8)
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:

Post by gnozal »

Library update

What's new :
- new function : PureCOLOR_SetMenuColors() ; see example below.

Code: Select all

Procedure.l WindowCallBack(WindowId.l, message.l, wParam.l, lParam.l)
  ReturnValue.l = #PB_ProcessPureBasicEvents
  ;
  ReturnValue = PureCOLOR_CallBack(WindowId, message, wParam, lParam, ReturnValue)
  ;
  ProcedureReturn ReturnValue
EndProcedure
;
If OpenWindow(0, 10, 10, 300, 200, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, "Ownerdraw Menu Demo")
  SetWindowCallback(@WindowCallBack())
  If CreateMenu(0, WindowID())
    MenuTitle("Menu 1")
    MenuItem(1, "Menu item 1")
    MenuItem(2, "Menu item 2")
    MenuItem(3, "Menu item 3")
    MenuItem(4, "Exit")
    MenuTitle("Menu 2")
    MenuItem(5, "Menu item 1")
    MenuItem(6, "Menu item 2 (longer)")
    MenuItem(7, "Menu item 3")
    MenuTitle("Extra menu")
    MenuItem(8, "Extra long menu item")
    OpenSubMenu("The level 1 submenu")
    MenuItem(9, "The pure power !")
    OpenSubMenu("The level 2 submenu")
    MenuItem(10, "What ?")
    MenuItem(11, "Hello ...")
    CloseSubMenu()
    CloseSubMenu()
  EndIf
  ;
  ; MENU COLORS
  ; -------------
  ; Owner drawn :
  ; -------------
  PureCOLOR_SetMenuColors(0, #Red, RGB(200, 255, 200), #Red, RGB(100, 255, 100))
  PureCOLOR_SetWindowColor(0, RGB(200, 255, 200))
  ; -------------
  ; or not (but then only backcolor) :
  ; -------------
  ;PureCOLOR_SetPopupMenuBackColor(0, RGB(200, 255, 200))
  ; -------------
  Repeat
    event = WaitWindowEvent()
  Until event = #PB_Event_CloseWindow
EndIf
End
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

Hi,

1. Thank you for a very useful and effective library, I have used it in two projects and find that subtle colour use can be a very good way to provide emphasis.

2. I have tried the sample code in your posting of today and find that the menu text and the sub-menu arrows crash. Its OK in background colour only mode. I'm using XP Pro; fully up to date.

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

Post by gnozal »

RichardL wrote:I have tried the sample code in your posting of today and find that the menu text and the sub-menu arrows crash. Its OK in background colour only mode. I'm using XP Pro; fully up to date.
Sadly I don't have XP, so I can't test it. It works well with Win98SE, and there is no text with NT4 (but no crash (missing API I think)).
- Do you use themes ?
- Do you have default system font for the menus ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

Hi,
I just re-read my post... sorry, it was misleading! The computer / program does not crash; what I should have said is that the text and the sub-menu arrow CLASH, the arrow appears over the text and not to the right of it.

Possibly an error in determining the text length in pixels?

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

Post by gnozal »

RichardL wrote:Possibly an error in determining the text length in pixels?
Yes, probably. It seems to work with my defaut system font (Win98), but at this time it's not very accurate. I will try do better.
What is your menu font ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Great addition. :)

Is it possible to add a feature to colour individual menu items?

-Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

OK:

The menu font is Tahona.

Windoze XP can use XP display mode or Classic display mode.
I run my machine in classic mode and the clash problem occurs.
I just switched it to XP mode and there was NO problem.
I then switched back to Classic and there was NO clash. Strange.

I will re-boot in classic mode and report back.
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

The problem has disappeared after a re-boot.

However, the first time I ran another another PB project the drop down menus were transparent... no text until I waved the mouse over them. I cannot repeat this effect.

I will report back if I can determine a stable bug.

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

Post by gnozal »

DoubleDutch wrote:Is it possible to add a feature to colour individual menu items?
It is possible :wink:
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Is it possible soon? :D
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply