It is currently Sun Sep 15, 2019 10:58 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [Done] PB v5.XX Create menu and #PB_Any
PostPosted: Mon Jan 08, 2018 9:32 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1900
Location: Germany
All PB Version 5.XX

CreateMenu and CreatePopuyMenu with #PB_Any

Crash by WaitWindowEvent()

Code:
If OpenWindow(0, 200, 200, 200, 100, "Menu Example")
  ;If CreateMenu(0, WindowID(0))    ; hier beginnt das Erstellen des Menüs...
  menu = CreateMenu(#PB_Any, WindowID(0))    ; hier beginnt das Erstellen des Menüs...
  If menu
    MenuTitle("Project")
    MenuItem(1, "Open"   +Chr(9)+"Ctrl+O")
    MenuItem(2, "Save"   +Chr(9)+"Ctrl+S")
    MenuItem(3, "Save as"+Chr(9)+"Ctrl+A")
    MenuItem(4, "Close"  +Chr(9)+"Ctrl+C")
  EndIf
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf


Code:
If OpenWindow(0, 200, 200, 200, 120, "Popup-Menu Example")
 
  ;If CreatePopupMenu(0)      ; hier beginnt das Erstellen des Popup-Menüs...
  menu = CreatePopupMenu(#PB_Any)      ; hier beginnt das Erstellen des Popup-Menüs...
  If menu      ; hier beginnt das Erstellen des Popup-Menüs...
    MenuItem(1, "Open")      ; Sie können alle Befehle zum Erstellen eines Menüs
    MenuItem(2, "Save")      ; verwenden, ganz wie bei einem normalen Menü...
    MenuItem(3, "Save as")
    MenuItem(4, "Quit")
    MenuBar()
    OpenSubMenu("Recent files")
    MenuItem(5, "PureBasic.exe")
    MenuItem(6, "Test.txt")
    CloseSubMenu()
  EndIf
 
  Repeat
    Event = WaitWindowEvent()    ; überprüfe Window-Ereignisse
   
    Select Event
      Case #PB_Event_RightClick       ; rechte Maustaste wurde gedrückt =>
        DisplayPopupMenu(menu, WindowID(0))  ; zeige jetzt das Popup-Menü an
       
      Case #PB_Event_Menu        ; ein Eintrag des Popup-Menüs wurde angeklickt
        Select EventMenu()       ; ermittle den angeklickten Menü-Eintrag...
          Case 1 : Debug "Menu: Open"
          Case 2 : Debug "Menu: Save"
          Case 3 : Debug "Menu: Save as"
          Case 4 : End
          Case 5 : Debug "Menu: PureBasic.exe"
          Case 6 : Debug "Menu: Text.txt"
        EndSelect
       
    EndSelect
   
  Until Event = #PB_Event_CloseWindow
EndIf

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: PB v5.XX Create menu and #PB_Any
PostPosted: Wed Apr 10, 2019 7:59 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13612
Location: France
Can't reproduce here, can anybody confirm ?


Top
 Profile  
Reply with quote  
 Post subject: Re: PB v5.XX Create menu and #PB_Any
PostPosted: Thu Apr 11, 2019 12:34 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1036
Location: right here
I can reproduce it with pb 546 x64 linux (which might be the latest version at the time mk posted), getting IMA at WaitWindowEvent() with both codes when clicking a menu entry.
But it works fine with the current pb 570 lts.

BTW:
In the museum the version 5.46 is not listed on the page. But I could download it by using another download link and modifying the URL. Maybe It should be added on the page.


Top
 Profile  
Reply with quote  
 Post subject: Re: PB v5.XX Create menu and #PB_Any
PostPosted: Thu Apr 11, 2019 1:14 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13612
Location: France
Thanks !


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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