GLBasic forum

Codesnippets => Userlibs [ *.gbal] => Topic started by: Schranz0r on 2009-May-27

Title: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-May-27
Simple and short:

Screenshot:

(http://www.glbasic.com/forum/index.php?action=dlattach;topic=3059.0;attach=556;image)

Code:
Code: GLBasic [Select]
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
 


[attachment deleted by admin]
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-May-27
If i can yes...
But i have some trouble with SHOWSCREEN it dispatch all my events...

This code works fine:

Code: GLBasic [Select]
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
 

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 :)
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: 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?
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-May-27
hehe coole Sache das, Schranzor  :good:

Hast den Petzold als Hilfe?

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

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!
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Kitty Hello on 2009-May-28
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.
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-May-28
Hey Gernot :)

Mir kommts so vor, als w?r irgendwo ein while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {...} w?r?!

Also das der alle Messages pl?ttet... kann das sein?
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Kitty Hello on 2009-May-28
Korrekt. Der war bei den Keyboard messages drin, damit man beim langen draufbleiben auf einer Taste kein Beeeeeeeep h?rt.
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-May-28
Kannst doch "nur" WM_KEYDOWN oder WM_INPUT abfragen? :D
Oder unter was l?uft das?

Ach, dann hat mein "bis jetzt nur" Menu ja auch was gutes :)
Jetzt kann man dann ordentlich mit PeekMessage arbeiten :P

Danke f?rs nachgucken Gernot!
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: FutureCow on 2009-May-29
Schranz0r - looking forward to this!
Can you post some English updates?
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-May-29
If it work, yes ;)
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-May-30
Sweet, Looking forward to this stuff, goodluck buddy!  :good:
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-Aug-07
it work now :) (with the RC2 of GLBasic!)
Without a DLL :P

You need the Headerpack from the mainpage: http://www.glbasic.com/files/headers.rar
Unpack to: ...GLBasic\Compiler\

Now you need that project: PROJECT (http://www.glbasic.com/forum/index.php?action=dlattach;topic=3059.0;attach=698)


Have fun

P.S.: I need help to wrapp the full GUI ;)



[attachment deleted by admin]
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Kitty Hello on 2009-Aug-07
Schranz0r, with the new IMPORT, it should be possible to wrap the API w/o the headers even.
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-Aug-07
No, i need all datatypes to wrapp all the stuff.
Now i can simply include windows.h, and i use it ;)
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-Aug-09
I unpacked the headers into the compiler directory,
but i still cant get it to compile, it says file not found in editor.
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-Aug-09
headers.rar is unpacked in E:\Program Files\GLBasic\Compiler

What else needs to be done?
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-Aug-09
K i had to redownload the headers...first round didnt work for some reason.



Schranz0r, here is a help messgae popup box...the popupflag=32 is the help icon type.

If you roll the flag number and post it to the screen, you can see all the different types of popup menus.
The flags can make also the kind that says "ignore" "continue" etc with the red x icon blah blah..

Code: GLBasic [Select]
popupflag=32
IMPORT "C" int __stdcall MessageBoxA(int hwnd, const char* text, char* caption, int flags)
MessageBoxA(0, " This is another line.\n this is another line\n ", "Help",popupflag)
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-Aug-09
Yeah i know that :)
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-Aug-10
Hey i found a bug with this..

In a windowed mode program, the mousestate and systempointer are not aligned.

This is what i have to do to correct the difference:

Code: GLBasic [Select]
MOUSESTATE MX,MY,MB1,MB2
MY=MY+20

In fullscreen, there is no menu.
Also in fullscreen, the mouse is correct.

Any idea how to fix this?
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-Aug-10
hmmm  :S
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-Aug-11
In fullscreen, no menu, but the mouse is aligned properly.
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Hemlos on 2009-Aug-11
Its not a big deal, ill just shift everything down.
Would be nice to use this in fullscreen mode though.
Title: Re: [Coming soon] GLBasic WinApi menu... Wow... :)
Post by: Schranz0r on 2009-Aug-11
dosent work on fullscreen!
Its a Window-Feature ;)