WinApi-Wrapper f?r GLBasic

Previous topic - Next topic

Schranz0r

Hi Leute,

Ich bin grade dabei einen WinApi-Wrapper f?r GLBasic zu schreiben.


Aktuell kann man:

Fenster erstellen ( egal wieviele!)
Fenster lassen sich frei bewegen( nicht eingefroren )
Textbuttons erstellen
Imagebuttons erstellen
Menus und untermenus und untermenus vom untermenu erstell :D
Titletext(caption) des Fensters oder Buttons ?ndern

Und nat?rlich Events abfragen  ;)

So sieht erstmal der Testcode aus:

Code (glbasic) Select
AUTOPAUSE FALSE

SETCURRENTDIR("Media") // seperate media


// Create a WindowClass (atm its very basic, in the future u can add flags!)
LOCAL myclass = API_CreateWndClass("Test")

// Create a Window (name$, width, height, parenthandle, wndclass)
LOCAL win = API_CreateWindow("TestWindow",640,480,0, myclass)




// Create a Menu
LOCAL mainmenu = API_CreateMenu()
LOCAL submenu = API_CreateMenu()

//Some Menu ID'S
LOCAL ID_Menu_AboutMe = 11
LOCAL ID_Menu_Close = 12

// insert a menu into the mainmenu
API_InsertMenu(mainmenu,0,submenu,"File")

// create a menu entry
API_AppendMenu(submenu,ID_Menu_AboutMe,"About me")

// add a seperator
API_AppendMenuSeperator(submenu)

// create another entry
API_AppendMenu(submenu,ID_Menu_Close,"Close project")

// set the menu to the window
API_SetMenu(win,mainmenu)




// set a ID for Button1
LOCAL ID_Button1 = 1

// Create Button1 (winhandle, name$, x, y, width, height, Button_ID)
LOCAL Button1 = API_CreateTextButton(win,"Button1",10,10,100,25, ID_Button1)

LOCAL ID_Button2 = 2
LOCAL Button2 = API_CreateTextButton(win,"Button2",10,40,100,25, ID_Button2)

LOCAL ID_Button3 = 3
LOCAL Button3 = API_CreateImageButton(win,"wtf.bmp",10,70,128,128, ID_Button3)



WHILE TRUE

SELECT API_GetMessageHWND() // get the current MessageHWND

CASE win // when its the "win-handle"!

IF API_OnCommand() // ask: is the message a command?

SELECT API_GetEvent() // if its a command, get the EventID!
CASE ID_Button1 // select the button

// set some informations in the title of "win"-Window
API_SetText(win,"You hit: Button1, ID: "+ID_Button1+", HWND: "+Button1)

CASE ID_Button2

API_SetText(win,"You hit: Button2, ID: "+ID_Button2+", HWND: "+Button2)

CASE ID_Button3

END // Close ALL!

CASE ID_Menu_AboutMe

API_MessageBox(win,"Winapi-Wrapper by Schranz0r","About me",0)

CASE ID_Menu_Close

END // Close ALL!

ENDSELECT

ENDIF

ENDSELECT

// print some GLB-Stuff
PRINT win,10,10

PRINT Button1,10,40
PRINT Button2,10,70
PRINT Button3,10,100


// IMPORTANT: Never forget the updatefunction !!!
API_UpdateWindow(win)
SHOWSCREEN
WEND
END



Wie man sieht ist alles noch recht mager von der "Freiheit" her.
Doch glaub mir, das wird noch anders ;)
Hier mein Bloglink dazu :

http://www.glbasic.com/forum/index.php?blog=64

Bis dahin...  :bed:

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Hemlos

Bing ChatGpt is pretty smart :O

Quentin

chice Sache. Bleib dran  :good:

Schranz0r

Hier der Blog dazu ;)
*Klick mich*

Gibt ein kleines Update
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Hemlos

sorry schranz...ive been trying to get this to work...no luck.
i have gui.gbas and gui.cpp, but it seems the update function is missing.

Could you repost this as a package in the forums 3rd party threads?
Bing ChatGpt is pretty smart :O

Schranz0r

hi, i have no clue what you want to do, but look at the Concept-Project... if you need a menu i dont know what project it was :D



[attachment deleted by admin]
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard