Ok. Can someone please help fix if you select a menu item, then return menuselect as 1 and the menu id. If menu id is a certain id, then activate a file request, or a function depending on menu id.
Thanks to anyone who helps! =)
~DarkShadowWing~
AppTitle "Particlos" Include "WB3DStyles.bb" ; setup gfx mode. Graphics3D 800,600,32,2 Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),10,10,GraphicsWidth(),GraphicsHeight()) Global FrameStart Global DeltaTime# = 0.1 Global GameTime# = 0 Global FPS = 1200 Global FPSCount = FPS Global timFPS Global menuselect = 0 Global keypressed Global menu WB3D_HotKeyEvent MOD_CONTROL,65,1 ; ctrl+a WB3D_HotKeyEvent MOD_CONTROL,76,78 ; ctrl+l ;WB3D_HotKeyEvent MOD_CONTROL,76, ; menus menus = WB3D_WindowMenu(RuntimeWindow_hWnd) file = WB3D_CreateMenu("File",0,menus,0) NewItem = WB3D_CreateMenu("&New "+WB3D_MENUHOTKEY_SPACER+"Ctrl+L",get_menu(),file,0) : WB3D_AddMenuIcon(file,1,"menuBMPS/MENUNEW.BMP") OpenItem = WB3D_CreateMenu("&Open.."+WB3D_MENUHOTKEY_SPACER+"Ctrl+O",get_menu(),file,0) : WB3D_AddMenuIcon(file,2,"menuBMPS/MENULOAD.BMP") WB3D_CreateMenu("",0,file,0) SaveItem = WB3D_CreateMenu("Save",get_menu(),file,0) : WB3D_AddMenuIcon(file,3,"menuBMPS/MENUSAVE.BMP") WB3D_CreateMenu("",0,file,0) QuitItem = WB3D_CreateMenu("Quit",get_menu(),file,0) : WB3D_AddMenuIcon(file,4,"menuBMPS/MENUQUIT.BMP") editmenu_window_1 = WB3D_CreateMenu("Edit",0,menus,0) CutItem = WB3D_CreateMenu("Cut",get_menu(),editmenu_window_1,0) ;: WB3D_AddMenuIcon(editmenu_window_1,5,"menuBMPS/MENUCUT.BMP") CopyItem = WB3D_CreateMenu("Copy",get_menu(),editmenu_window_1,0) ;: WB3D_AddMenuIcon(editmenu_window_1,6,"menuBMPS/MENUCOPY.BMP") PasteItem = WB3D_CreateMenu("Paste",get_menu(),editmenu_window_1,0) ;: WB3D_AddMenuIcon(editmenu_window_1,7,"menuBMPS/menupaste.BMP") If file Or NewItem Or SaveItem Or QuitItem Or CutItem Or CopyItem Or PasteItem Then menuselect = 1 WB3D_RadiocheckMenu editmenu_window_1,5,7,6 WB3D_UpdateWindowMenu(RuntimeWindow_hWnd) statusbar = WB3D_CreateStatusBar(RuntimeWindow_hWnd,"") WB3D_SetStatusParts statusbar,2 WB3D_StatusPartWidth(statusbar,0,150) WB3D_StatusPartWidth(statusbar,1,150) WB3D_StatusPartWidth(statusbar,2,150) ;WB3D_StatusPartWidth(statusbar,3,200) ;WB3D_StatusPartWidth(statusbar,4,-1) ;WB3D_SetStatusText statusbar,1,"part 1" ;WB3D_SetStatusText statusbar,3,"part 3" ;WB3D_SetStatusText statusbar,4,"part 4" WB3D_UpdateStatusbar statusbar ; cleanup any old creation events, its better to do this before we enter the main ; event loop, when some gadgets are created they generate events. WB3D_FlushEvents ; setup out quit flag, and loop until the flag is set. QUIT = 0 While Not QUIT = 1 menuselect = 0 WB3D_SetStatusText statusbar,2,"menuselect:"+menuselect WB3D_SetStatusText statusbar,1,"menu:"+menu ; Frame Update FrameStart = MilliSecs() If timFPS < FrameStart Then FPS = FPSCount FPSCount = 0 timFPS = FrameStart + 1000 DeltaTime = 1.0 / Float(FPS) GameTime = GameTime + DeltaTime End If WB3D_SetStatusText statusbar,0,"FPS: "+FPS ; generate an internal blitz event Flip ; get an event of the event queue. event = WB3D_WaitEvent() Select event Case WB3D_EVENT_MENU If menuselect > 0 And menu = 2 ext$ = "*.mid"+Chr$(0)+"*.mid"+Chr$(0)+"*.mp3"+Chr$(0)+"*.mp3"+Chr$(0) WB3D_OpenFileRequest("..", "..",ext$, "") If opens = 1 Then DebugLog menu EndIf Case WB3D_EVENT_KEYPRESS ; wb_eventdata holds the key code that was pressed. keypressed = WB3D_EventData() DebugLog "Keypressed: "+keypressed + " : " + "flag: "+WB3D_EventFlagKey() Select keypressed ;Case WB3D_KEY_CONTROL ; DebugLog "Keypressed: "+ + " : " + flagkey Case WB3D_KEY_ESCAPE ; set the flag to leave the loop. QUIT = 1 End Select Case WB3D_EVENT_WINDOW_CLOSE ;WB3D_ShowGadget RuntimeWindow_hWnd Select WB3D_EventSource() Case RuntimeWindow_hWnd QUIT = 1 ;state = WB3D_Notify("Quit","Save changes",MB_YESNOCANCEL) ;Select state ; ; Case IDCANCEL ; ; Case IDYES ; ; Case IDNO ; QUIT = 1 ; ;End Select End Select End Select FPSCount = FPSCount + 1 Flip Wend Function get_menu() If menuselect > 0 menu = menu + 1 If menu > 43 Then menu = 43 Return menu EndIf End Function Function FileExtension$(ext$) For I% = Len(ext$) To 1 Step -1 If Mid$(ext$, I%,1) = "," Then Return "*"+Left(ext$, I%-1)+";"+"*"+ Right$(ext$, I%-1) Next End Function Function FileName$(File$) For I% = Len(File$) To 1 Step -1 If Mid(File$, I%, 1) = "" Or Mid(File$, I%, 1) = "/" Then Return Mid(File$, I% + 1) Next Return File$ End Function Function FileExtention$(File$) For I% = Len(File$) To 1 Step -1 If Mid(File$, I%, 1) = "." Return "."+Mid(File$, I% + 1) If Mid(File$, I%, 1) = "" Or Mid(File$, I%, 1) = "/" Then Return "" Next End Function Function FilePath$(File$) For I% = Len(File$) To 1 Step -1 If Mid(File$, I%, 1) = "" Or Mid(File$, I%, 1) = "/" Then Return Left(File$, I% - 1) Next End Function ; Adds a file extention, if not exists. | FEt eine Dateiendung hinzu falls noch keine da ist. Function AddFileExtention$(File$, Extention$) If FileExtention(File$) = "" Then Return File$ + "." + Extention$ Else Return File$ End Function ; use notify using external winapi constants. WB3D_Notify "WB3D GUI Window Example","Bye, Thats It I Quit",MB_OK Or MB_ICONASTERISK WB3D_EndGUI() EndGraphics End
Thanks to anyone who helps! =)
~DarkShadowWing~