Posted: Fri Sep 09, 2005 12:42 pm
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.
http://www.purebasic.com
https://www.purebasic.fr/english/
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.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.
ThanksXombie wrote:gnozal - thanks a lot for the great
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
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)).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.
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.RichardL wrote:Possibly an error in determining the text length in pixels?
It is possibleDoubleDutch wrote:Is it possible to add a feature to colour individual menu items?