It is currently Thu Jul 19, 2018 8:45 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Library XP_Menu_Lib
PostPosted: Wed Nov 12, 2008 6:02 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
Hi :)
I do not know english, sorry


I have done library for menu


Example
Code:
; For compiling library needs Library XP_Menu_Lib - http://purik.nextmail.ru/PureBasic/XP_Menu_Lib.rar

Procedure GlavWindowCallback(WindowID, Message, wParam, lParam)
Protected Result=#PB_ProcessPureBasicEvents

XP_Menu_CB(WindowID, Message, wParam, lParam)

ProcedureReturn Result
EndProcedure

StyleMenu.xp_menudata

OpenWindow(4,0,0,300,200,"Example XP_Menu_Lib",#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
CreateGadgetList(WindowID(4))

CheckBoxGadget(0,10,20,200,15,"Style menu general")    : SetGadgetState(0,1)
CheckBoxGadget(1,10,50,200,15,"Style menu popup") : SetGadgetState(1,1)
CheckBoxGadget(2,10,80,200,15,"Style menu system")   : SetGadgetState(2,1)
CheckBoxGadget(3,10,110,200,15,"Style menu tray")      : SetGadgetState(3,1)

TextGadget(4,10,140,80,15, "Style menu")
ComboBoxGadget(5,80,136,100,100)
 AddGadgetItem(5,-1,"Standart")
 AddGadgetItem(5,-1,"XP")
 AddGadgetItem(5,-1,"2003")
 AddGadgetItem(5,-1,"Create style")
SetGadgetState(5,1)


   If CreateMenu(2,WindowID(4))
      MenuTitle("File")
    MenuItem(1,"New"+Chr(9)+"Ctrl+N")
    MenuItem(2,"Open..."+Chr(9)+"Ctrl+N") : DisableMenuItem(2,2,1)
    MenuItem(3,"Save"+Chr(9)+"Ctrl+N")
    MenuItem(4,"Save As..."+Chr(9)+"Ctrl+N") : DisableMenuItem(2,4,1) : SetMenuItemState(2,4,1)
    MenuItem(46,"Save All"+Chr(9)+"Ctrl+N")
    MenuItem(15,"Close"+Chr(9)+"Ctrl+N") : SetMenuItemState(2,15,1)
    MenuBar()
    OpenSubMenu("Files")
     MenuItem(20,"1)    1")
     MenuItem(21,"2)    2")
     MenuItem(22,"3)    3")
     MenuItem(23,"4)    4")
     MenuItem(24,"5)    5")
     MenuItem(25,"6)    6")
     MenuItem(26,"7)    7")
     MenuItem(27,"8)    8")
     MenuItem(28,"9)    9")
     MenuItem(29,"10)  10")
    CloseSubMenu()
    ; Ðàçäåëèòåëü ìåæäó ïóíêòàìè.
    MenuBar()
    MenuItem(6,"Exit")
       MenuTitle("Edit")
    MenuItem(7, "Undo")
    MenuItem(8,"Redo")
   
      MenuTitle("Help")
      MenuItem(2,"About")
      MenuBar()
      OpenSubMenu(" ¹1")
      For i=2 To 8
      MenuItem(1,"Item")
      OpenSubMenu(" ¹"+Str(i))
       
     
      Next
     
      CloseSubMenu()
      CloseSubMenu()
      CloseSubMenu()
      CloseSubMenu()
      CloseSubMenu()
      CloseSubMenu()
      CloseSubMenu()
      CloseSubMenu()
      MenuItem(73,"Item")
     
    EndIf
   
   
  If  CreatePopupMenu(8)
   MenuItem(1,"Item 1")
   MenuItem(2,"Item 2")
  EndIf
   
   If  CreatePopupMenu(10)
   MenuItem(1,"Item 3")
   MenuItem(2,"Item 4")
  EndIf
   
   
   
  ExtractIcon_(0,GetSystemDirectory()+"\sendmail.dll",0) 
  AddSysTrayIcon(0,WindowID(4),ExtractIcon_(0,GetSystemDirectory()+"\sendmail.dll",0) )
  SysTrayIconToolTip(0,"Ðîáîòà XP_Menu_Lib")

SetWindowCallback(@GlavWindowCallback(),4)


; #XP_RegMenu - Registration menu
; #XP_DelMenu - Removing to registrations menu
 
XP_MenuRegister(MenuID(2), #XP_RegMenu, #XP_RegGeneralMenu,WindowID(4)) ; Ðåãèñòðàöèÿ ãëàâíîãî ìåíþ
XP_MenuRegister(MenuID(8), #XP_RegMenu, #XP_RegPopupMenu)  ; Ðåãèñòðàöèÿ êîíòåêñòíîãî ìåíþ
XP_MenuRegister(GetSystemMenu_(WindowID(4),0), #XP_RegMenu, #XP_RegSysMenu) ; Ðåãèñòðàöèÿ ñèñòåìíîãî ìåíþ
XP_MenuRegister(MenuID(10), #XP_RegMenu, #XP_RegPopupMenu) ; Ðåãèñòðàöèÿ êîíòåêñòíîãî ìåíþ â òðåå


XP_SetMenuIcon(MenuID(2),1,ExtractIcon_(0,GetSystemDirectory()+"\sendmail.dll",0) )
XP_SetMenuIcon(MenuID(2),2,ExtractIcon_(0,GetSystemDirectory()+"\shell32.dll",19) )
XP_SetMenuIcon(MenuID(2),41,ExtractIcon_(0,GetSystemDirectory()+"\shell32.dll",38) )
 


HideWindow(4,0)

; Debug XP_GetMenuItemText(MenuID(2), 2)
; Debug XP_GetMenuItemText(MenuID(2), 47)

;Debug MenuID(2)
Repeat
 Event=WaitWindowEvent()
 Gadget=EventGadget()
 Type=EventType()
 Menu=EventMenu()
   
   
    If Event=#WM_RBUTTONUP
     DisplayPopupMenu(8, WindowID(4))
    EndIf
   
    If Event=#PB_Event_SysTray
      If Type=#PB_EventType_RightClick
       DisplayPopupMenu(10, WindowID(4))
      EndIf
    EndIf
   
    If Event = #PB_Event_Gadget
     Select Gadget
      Case 0
       If XP_GetMenuStyle()=#XP_StyleNormal
        XP_MenuRegister(MenuID(2), GetGadgetState(0), #XP_RegGeneralMenu)
       Else
        XP_MenuRegister(MenuID(2), GetGadgetState(0), #XP_RegGeneralMenu, WindowID(4))
       EndIf
      Case 1
       XP_MenuRegister(MenuID(8), GetGadgetState(1), #XP_RegPopupMenu)
      Case 2
       XP_MenuRegister(GetSystemMenu_(WindowID(4),0),GetGadgetState(2), #XP_RegSysMenu)
      Case 3
       XP_MenuRegister(MenuID(10), GetGadgetState(3), #XP_RegPopupMenu)
      Case 5 ; Ñòèëü ìåíþ
       If Type=1
       
     
       Select GetGadgetState(5)
        Case 0
         XP_SetMenuStyle(#XP_StyleNormal)
         XP_EnableDrawTitleBar(WindowID(4), #XP_DelMenu)
        Case 1
         XP_SetMenuStyle(#XP_StyleXP)
         XP_EnableDrawTitleBar(WindowID(4), #XP_RegMenu)

        Case 2
         XP_SetMenuStyle(#XP_Style2003)
         XP_EnableDrawTitleBar(WindowID(4), #XP_RegMenu)
        Case 3
       
        XP_GetMenuStructure(StyleMenu)
       
         StyleMenu\ColFillColor               = RGB(242, 229, 241)
         StyleMenu\FrameColor                 = RGB(105, 5, 93)
         StyleMenu\BackgroundColor            = RGB(255, 255, 216)
         StyleMenu\TextSelectColor            = RGB(221, 129, 80)
         StyleMenu\TextNormalColor            = RGB(108, 2, 98)
         StyleMenu\TextSelectTABColor         = RGB(1, 44, 173)
         StyleMenu\TextNormalTABColor         = RGB(71, 135, 64)
         StyleMenu\IconBarGradientStartColor  = RGB(248, 248, 248)
         StyleMenu\IconBarGradientEndColor    = RGB(185, 116, 185)
         
         StyleMenu\CheckBoxEnableActive_CHECK_Color = RGB(255, 252, 0)
         StyleMenu\CheckBoxEnable_CHECK_Color       = RGB(0, 0, 233)
         StyleMenu\CheckBoxDisableActive_CHECK_Color= RGB(255, 129, 0)
         StyleMenu\CheckBoxDisable_CHECK_Color      = RGB(255, 108, 108)
         StyleMenu\CheckBoxEnableActive_BACK_Color  = RGB(215, 160, 199)
         StyleMenu\CheckBoxEnable_BACK_Color        = RGB(178, 70, 146)
         StyleMenu\CheckBoxDisableActive_BACK_Color = RGB(57, 172, 115)
         StyleMenu\CheckBoxDisable_BACK_Color       = RGB(165, 126, 159)
         StyleMenu\CheckBoxEnableActive_FRAME_Color = RGB(233, 8, 0)
         StyleMenu\CheckBoxEnable_FRAME_Color       = RGB(231, 230, 2)
         StyleMenu\CheckBoxDisableActive_FRAME_Color= RGB(158, 156, 144)
         StyleMenu\CheckBoxDisable_FRAME_Color      = RGB(158, 156, 144)

        XP_SetMenuStructure(StyleMenu)
       
       
        XP_EnableDrawTitleBar(WindowID(4), 1)
       EndSelect 
      EndIf
     EndSelect
    EndIf

Until Event=#PB_Event_CloseWindow



Library for PB 4.50

Here library is discussed in russian language
http://pbasic.spb.ru/phpBB2/viewtopic.php?t=596


Last edited by User_Russian on Sun Jul 14, 2013 1:36 pm, edited 8 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 12, 2008 6:23 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
Looks interesting.

Would you consider releasing in source code form perhaps? I ask because I will no longer use any 3-rd party compiled user-libraries as they invariably get broken with new versions of Purebasic etc. and I am thus completely at the mercy of the original developer etc. At least with source code I can, if the author discontinues updates etc, update the code myself.

If you cannot release the source then I will understand. :) At the very least you will then need to release Unicode / Ansi and threadsafe versions etc. Will there be a version for PB 4.3?

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 12, 2008 7:59 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
Quote:
Would you consider releasing in source code form perhaps?

While not, sorry

Quote:
At the very least you will then need to release Unicode / Ansi and threadsafe versions etc
Has Updated the file on server.
Available on same reference.

Quote:
Will there be a version for PB 4.3?
little later will


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 13, 2008 11:29 am 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
Has Updated the file on server.
Available on same reference.

Has Translated help on english


PS.
What place library on web site http://www.purearea.net/pb/english/userlibs.php ?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 13, 2008 12:36 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 26, 2003 1:11 am
Posts: 1384
As its comes NOT with source, its not a topic for
the Tips&Tricks Section.
Also its Windows only and the lib is hosted by a
freehoster where not all ppl can read that stuff.

Imho,

i moved it to the anouncement section.

_________________
SPAMINATOR NR.1


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 13, 2008 3:44 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Oct 24, 2008 2:07 pm
Posts: 228
Why occured this?
Image

A little bug in exe example:
Image

That's good your project able to Change titlebar menu ,but thw width of menu is less than what is necessary.
btw, thanks for your attempt it is usefull really.

edit:
oh, none any an answering yet :?:


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Nov 16, 2008 2:09 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
Quote:
Why occured this
Install library Droopy Library
For PB 4.00 http://www.purearea.net/pb/download/userlibs/DroopysLib_installer1.31.4.zip
For PB 4.10 and PB4.20 http://www.purearea.net/pb/download/userlibs/Droopys_lib_1.31.9.zip

Quote:
A little bug
This bug is already eliminated.
New version of the library shall publish in the near future

Image

Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 17, 2008 4:40 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
Quote:
New version of the library shall publish in the near future


Has Updated the file on server.
Available on same reference.

Add new functions


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 17, 2008 5:20 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Hi, I just tried your compiled example on WinNT4 : Examples_XP_Menu_Lib.exe.
It doesn't work : no menu item text is shown, with any of the settings (here 2003).
Image

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 17, 2008 7:15 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
I not checked functioning the library in WinNT4, but on Win98Sse and WinXP such bug not.
But possible bug because of that that beside You are not displayed russian letters, this on picture is seen.


Compile example from first post.
If bug will, that he because of WinNT4


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 18, 2008 9:36 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
User_Russian wrote:
Compile example from first post.
If bug will, that he because of WinNT4
Still the same problem.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 18, 2008 12:42 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1003
Location: Russia
Possible in WinNT4 incorrect works API function GetMenuItemInfo.

Text from item menu is read by means of this procedure
Code:
Procedure$ GetMenuIDName(itemID)
Protected ItemName$
MII\cbSize        = SizeOf(MENUITEMINFO)
MII\fMask         = #MIIM_STRING
MII\fType         = #MFT_STRING
MII\dwTypeData    = AllocateMemory(1024)
MII\cch           = 1023
If GetMenuItemInfo_(hMenu,itemID,0,MII)
  ItemName$        = PeekS(MII\dwTypeData)
EndIf
FreeMemory(MII\dwTypeData)
ProcedureReturn ItemName$
EndProcedure


If she returns am empty the line, that this is perceived as separator, that exists in your event.
If there is symbols in line, that this is perceived as item menu.

Try to compile the source file Popup-Menu_OfficeXP-Style.PB (CodeArchiv), on base which is created library.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 18, 2008 12:58 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
User_Russian wrote:
Possible in WinNT4 incorrect works API function GetMenuItemInfo.
Yes, I know there is a problem with GetMenuItemInfo_() and NT4. You cannot rely on this function to get the menu item text. You have to store it for each menu item and recall the text when you have to measure it (#WM_MEASUREITEM event) or draw it (#WM_DRAWITEM event).
User_Russian wrote:
Try to compile the source file Popup-Menu_OfficeXP-Style.PB (CodeArchiv), on base which is created library.
That explains it : this code never worked on NT4.

Anyway, no problem for me. I just wanted you to be aware of this issue.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 18, 2008 1:52 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10413
Location: Beyond the pale...
Gnozal, when are you going to get rid of that ancient NT 4 install and join the 21st century? :twisted:

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 18, 2008 3:28 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
srod wrote:
Gnozal, when are you going to get rid of that ancient NT 4 install and join the 21st century? :twisted:
I have some 20th century stuff because some american lab software (FDA approved ...) we use was only validated for NT4 ... We already replaced some PC with XP. Still, there are some oldies left (software and hardware) :wink:

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye