Code shoudld look something like this: myButton=API_Button_Create(.....);
It does. But when I run it in debug mode, myButton has the same value as anotherButton.
Posted 25 June 2008 - 12:54 PM
Code shoudld look something like this: myButton=API_Button_Create(.....);
Posted 29 June 2008 - 12:13 PM
Posted 10 July 2008 - 09:12 PM
regt = API_Button_Create(window_handle(),x+40,y+440,110,2
1,BS_CENTER,false);
API_Control_SetText(regt,"Click Me!");
cmd = API_Check_Command(1);
if (cmd == regt)
{
show_message("You clicked me!");
}
Posted 10 July 2008 - 09:44 PM
Posted 10 July 2008 - 10:00 PM
you forgot to add after you create the button
API_Check_Set(1,window_handle());
Posted 17 July 2008 - 10:09 PM
Edited by molloyboy08, 17 July 2008 - 10:30 PM.
Posted 27 July 2008 - 03:34 AM
Edited by Todi, 27 July 2008 - 03:36 AM.
Posted 01 October 2008 - 11:35 PM
Edited by allan124, 01 October 2008 - 11:36 PM.
Posted 31 January 2010 - 03:35 AM
Posted 03 November 2011 - 06:27 PM
Posted 09 November 2011 - 01:42 PM
Posted 08 February 2012 - 09:01 PM
Posted 08 July 2012 - 12:09 PM
If I'm using the API_Controls_EnableAgw function to place the controls in the game window, what do I put for 'Real Parent Handle' when making a checkbox?
Thanks!
You would pass it the window_handle, which you can get with the GM method window_handle();
But actually GM windows are known to cause something like
as per http://gmc.yoyogames...&...t&p=1859617 apparently due to the way the DLL interacts with GM Windows which use DirectX. http://gmc.yoyogames...&...t&p=1860396 explains it roughly.
Point is, it would be better to create a new window using the dll.
What I recommend is the following in the create event:global.window[0] = window_handle(); API_Window_Show(global.window[0],SW_HIDE); W = room_width; H = room_height; X = window_client_left-5; Y = window_client_top-32; global.window[1] = API_Window_Create(X,Y,W,H,WS_CAPTION|WS_POPUPWINDOW|WS_SYSMENU|W S_MAXIMIZEBOX|WS_MINIMIZEBOX,false); API_Check_Set(1,global.window[1]);
This will create a new MaxWinAPI window, and hide the GM window (so you don't have an unnecessary window if you don't use it). The reason I passed global.window[1] "false" for the parent, is that I don't want them to be related. In other words, me making global.window[0] (the GM window) hidden has no effect on global.window[1] (the actual game window, that the DLL created). The code also puts the new window in the same place (approximately) the GM window would have been, and makes it the same size as the room. Thus you have a dll-created window that is a near perfect replacement for the GM-made one.
Don't forget to putif(API_Check_Quit(1) || keyboard_check_direct(vk_escape)) { game_end(); }
in the Step event. This will end the game if the window you created was closed, or if ESC was pressed.
___________________________________________
ERROR in
action number 1
of Create Event
for object Controller:
Error in code at line 8:
X = window_client_left-5;
^
at position 6: Unknown variable window_client_left
0 members, 0 guests, 0 anonymous users