Library XP_Menu_Lib

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Being NT4 compatible is still a good idea, there are still loads of people with NT4 machines.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

Here is new version of the library in action
She will be a worthy change CoolMenu.dll

Image

Image

Image

Image



The Library while not yet ready.
Shall publish in the near future.
+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

Post by +18 »

User_Russian wrote:
Why occured this
Install library Droopy Library
For PB 4.00 http://www.purearea.net/pb/download/use ... 1.31.4.zip
For PB 4.10 and PB4.20 http://www.purearea.net/pb/download/use ... 1.31.9.zip
A little bug
This bug is already eliminated.
New version of the library shall publish in the near future

Image

Image
Ok, We're waiting for your great work :)
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

New version of the library http://purik.nextmail.ru/PureBasic/XP_Menu_Lib.rar

Example of the use

Code: Select all

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


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

XP_Menu_CB(WindowID, Message, wParam, lParam)

ProcedureReturn Result 
EndProcedure



Procedure SetSideText_CB(*DIS.DRAWITEMSTRUCT, *SideText.Xp_SideText)
Shared FontID_Text, FontID_Text_1, FontID_Text_2
Protected Result.c=0
*SideText\y=2
*SideText\x=2
*SideText\FontID=FontID_Text
*SideText\Color=RGB(147, 2, 108)
   
If  *SideText\MenuType=0 ; General menu
   
 Select *SideText\TitlePopupMenu
  Case "File" 
   *SideText\Text="File"
   Result=1
  
  Case "Edit" 
   *SideText\Text="Edit"
   Result=1
  
  Case "Help"
   *SideText\Text="Help"
   Result=1
   
  Case "Files"
   *SideText\Text="Recent Files"
   Result=1

 EndSelect 

ElseIf  *SideText\MenuType=1 ; Popup menu
  If *DIS\hwndItem=MenuID(8)
    *SideText\Text="Popup"
    *SideText\Color=0
    *SideText\FontID=FontID_Text_1
     Result=1
  ElseIf *DIS\hwndItem=MenuID(10)
    *SideText\Text="Tray"
    *SideText\Color=RGB(255, 11, 0)
    *SideText\FontID=FontID_Text_2
    *SideText\y=0
     Result=1
  EndIf
 
ElseIf  *SideText\MenuType=2 ; System menu
 *SideText\FontID=FontID_Text_1
 *SideText\Color=RGB(254, 25, 21)
 *SideText\Text="System menu"
 *SideText\x=4
 *SideText\y=10
   Result=1
 
EndIf

ProcedureReturn Result
EndProcedure


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,"2000") 
 AddGadgetItem(5,-1,"XP") 
 AddGadgetItem(5,-1,"2003") 
 AddGadgetItem(5,-1,"Violet") 
 AddGadgetItem(5,-1,"Black") 
SetGadgetState(5,2) 



;ImageGadget(7,250,0,10,10,0)

   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,"Example XP_Menu_Lib")

SetWindowCallback(@GlavWindowCallback(),4) 


 
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(GetSystemMenu_(WindowID(4),0), #XP_DelMenu, #XP_RegSysMenu) ; Ðåãèñòðàöèÿ ñèñòåìíîãî ìåíþ
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),3,ExtractIcon_(0,GetSystemDirectory()+"\shell32.dll",38) )

;XP_SetMenuStyle()
 
FontID_Text=LoadFont(4, "MS Sans Serif", 10,#PB_Font_Bold)
FontID_Text_1=LoadFont(5, "MS Sans Serif", 8)
FontID_Text_2=LoadFont(6, "Verdana", 12,#PB_Font_Bold)
  
XP_SetSideText_CB(@SetSideText_CB()) ; Îáðàáîò÷èê ñîáûòèé îò ìåíþ. Èñïîëüçóåòñÿ äëÿ îòîáðàæåíèÿ òåêñòà â îáëàñòè çíà÷êîâ

HideWindow(4,0)

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
       
      ;XP_GetMenuStructure(StyleMenu)
      
       Select GetGadgetState(5)
        Case 0
         XP_SetMenuStyle(#XP_StyleNormal)
         XP_EnableDrawTitleBar(WindowID(4), 0)
        Case 1
         XP_SetMenuStyle(#XP_StyleXP)
         XP_EnableDrawTitleBar(WindowID(4), 1)
        Case 2
         XP_SetMenuStyle(#XP_Style2003)
         XP_EnableDrawTitleBar(WindowID(4), 1)
        Case 3
         XP_SetMenuStyle(#XP_StyleViolet)
         XP_EnableDrawTitleBar(WindowID(4), 1)
        Case 4
         XP_SetMenuStyle(#XP_StyleBlack)
         XP_EnableDrawTitleBar(WindowID(4), 1)
       EndSelect  
      EndIf
     EndSelect
    EndIf

Until Event=#PB_Event_CloseWindow
Voice your opinions about library.
Being NT4 compatible is still a good idea, there are still loads of people with NT4 machines
NT4 correct works with API function GetMenuString?
hichem
User
User
Posts: 26
Joined: Sun Sep 04, 2005 4:18 pm

Post by hichem »

very nice job user_russian, thanks but with this last example i have this message : "the following purelibrary is missing : StringExtension. is this related to your lib or ??

thank's in advance.
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

The Library in PB 4.00, 4.10 and 420 works orderly.
In PB 4.30 until checked.
Can you use PB 4.30?
User avatar
Alireza
Enthusiast
Enthusiast
Posts: 143
Joined: Sat Aug 16, 2008 2:02 pm
Location: Iran

Post by Alireza »

Hello User_Russian
Your project is exelent really
why don't continue that to ending?
Thanks for sharing
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

User avatar
Alireza
Enthusiast
Enthusiast
Posts: 143
Joined: Sat Aug 16, 2008 2:02 pm
Location: Iran

Post by Alireza »

Xmass Version!
Thanks User_Russian. :)
I 've hope to see your nice future project as soon.
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Library XP_Menu_Lib

Post by User_Russian »

+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

Re: Library XP_Menu_Lib

Post by +18 »

nice work, thanks User_Russian
maybe see more from u :D
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Re: Library XP_Menu_Lib

Post by GeoTrail »

I didn't know there were such a large Russian community for PB :)
Nice work :) Хорошая работа.
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: Library XP_Menu_Lib

Post by SFSxOI »

Looks good. Any source code?
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

Re: Library XP_Menu_Lib

Post by +18 »

omg, some people are in waiting for new version with more brilliant views :D
please man
Post Reply