Codesnippets > Userlibs [ *.gbal]

[Coming soon] GLBasic WinApi menu... Wow... :)

(1/5) > >>

Schranz0r:
Simple and short:

Screenshot:



Code:

--- Code: (glbasic) ---LOCAL WM_LBUTTONDOWN  = 0x0201
LOCAL WM_RBUTTONDOWN  = 0x0204
LOCAL WM_COMMAND = 0x0111

// Create a Mainmenu and Submenus(popupmenus)
MainMenu = Menu_CreateMenu() // Mainmenu
FileMenu = Menu_CreateMenu() // Popupmenu "FileMenu"
OpenMenu = Menu_CreateMenu() // Popupmenu "OpenMenu"


// Menu ID's ... you can make what you want ;)
ID_Menu = 100
ID_Save = 110
ID_Open = 120
ID_LoadFile = 121
ID_OpenProj = 122
ID_Exit = 101

Menu_InsertMenu(MainMenu,ID_Menu,FileMenu,"File") // Set Mainmenu and insert a popup filemenu
Menu_AppendMenu(FileMenu,ID_Save,"Save") // Add "save" to filemenu
Menu_AppendSeperator(FileMenu) // create a seperrator(filemenu)
Menu_InsertMenu(FileMenu,ID_Open,OpenMenu,"Open") // insert popup openmenu
Menu_AppendMenu(OpenMenu,ID_LoadFile,"Load file") // Add "Load file" to openmenu
Menu_AppendMenu(OpenMenu,ID_OpenProj,"Load project") // Add "Load project" to openmenu
Menu_AppendSeperator(FileMenu) // create a seperrator(filemenu)
Menu_AppendMenu(FileMenu,ID_Exit,"Exit") // Add "Exit" to filemenu

Menu_SetMenu(MainMenu) // Set Menu "Mainmenu" to GLBasic



WHILE TRUE

// Other stuff coming soon!

SHOWSCREEN
WEND
END

--- End code ---


[attachment deleted by admin]

Schranz0r:
If i can yes...
But i have some trouble with SHOWSCREEN it dispatch all my events...

This code works fine:


--- Code: (glbasic) ---LOCAL WM_LBUTTONDOWN  = 0x0201
LOCAL WM_RBUTTONDOWN  = 0x0204
LOCAL WM_COMMAND = 0x0111

// Create a Mainmenu and Submenus(popupmenus)
MainMenu = Menu_CreateMenu() // Mainmenu
FileMenu = Menu_CreateMenu() // Popupmenu "FileMenu"
OpenMenu = Menu_CreateMenu() // Popupmenu "OpenMenu"


// Menu ID's ... you can make what you want ;)
ID_Menu = 100
ID_Save = 110
ID_Open = 120
ID_LoadFile = 121
ID_OpenProj = 122
ID_Exit = 101

Menu_InsertMenu(MainMenu,ID_Menu,FileMenu,"File") // Set Mainmenu and insert a popup filemenu
Menu_AppendMenu(FileMenu,ID_Save,"Save") // Add "save" to filemenu
Menu_AppendSeperator(FileMenu) // create a seperrator(filemenu)
Menu_InsertMenu(FileMenu,ID_Open,OpenMenu,"Open") // insert popup openmenu
Menu_AppendMenu(OpenMenu,ID_LoadFile,"Load file") // Add "Load file" to openmenu
Menu_AppendMenu(OpenMenu,ID_OpenProj,"Load project") // Add "Load project" to openmenu
Menu_AppendSeperator(FileMenu) // create a seperrator(filemenu)
Menu_AppendMenu(FileMenu,ID_Exit,"Exit") // Add "Exit" to filemenu

Menu_SetMenu(MainMenu) // Set Menu "Mainmenu" to GLBasic



WHILE TRUE


WHILE Peekmessage()

GLBmsg = ReciveMessage()

SELECT GLBmsg
CASE WM_COMMAND

SELECT GetWParam()
CASE ID_Exit
END
ENDSELECT

DEFAULT
DispatchMessage()
ENDSELECT

WEND


//SHOWSCREEN


WEND
END

--- End code ---

I can move the window, navigate on the menu and can close the window with the menuentry "Exit"
But the GLBasicstuff freeze :/ ( no SHOWSCREEEN)

If i place SHOWSCREEN, then SHOWSCREEN dispatch all my messages... it sucks :)

Quentin:
hehe coole Sache das, Schranzor  :good:

Hast den Petzold als Hilfe?

Schon mal mit ShowWindow() und UpdateWindow() probiert anstatt SHOWSCREEN?

Schranz0r:

--- Quote from: Quentin on 2009-May-27 ---hehe coole Sache das, Schranzor  :good:

Hast den Petzold als Hilfe?

Schon mal mit ShowWindow() und UpdateWindow() probiert anstatt SHOWSCREEN?

--- End quote ---

Das wird nix bringen, weil der das ja alles "updatet" bis auf den GLB-Buffer
Wer oder was ist Petzold? :D
Alles von mir selber zusammen gesucht :)



@ Ocean:

Ja da schau ich mal, geb dan R?ckmeldung :D

EDIT:

Ney, geht nicht... Schade!

Kitty Hello:
Oh! Shranzor, ich hab's gefunden. Meine Tastaturabfrage hat PeekMessage f?r alle Fenster gemacht. In Version 7 wird's gel?st sein. Ich schick dir zum Wochenende eine Beta.

Navigation

[0] Message Index

[#] Next page

Go to full version