Jump to content


Photo

Max Winapi 2


  • Please log in to reply
154 replies to this topic

#141 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 09 August 2011 - 04:38 AM

Hi i have a problem with tabs
When i create a control on a tab-field i cant click on it
I cant assign a control to a tab - the control ist just like freezed

for example:

tab_main = API_Tab_Create(win_main,0,0,300,200)
API_Tab_SetMinWidth(tab_main,100)

API_Tab_InsertItem(tab_main,0,"TestTab1")
API_Tab_InsertItem(tab_main,1,"TestTab2")

API_Control_SetAutoTab(0)

but_test0 = API_Button_Create(win_main,50,500,100,40,BS_CENTER)
API_Control_SetText(but_test0,"Enable List")

can someone help me please?

/edit
Can someone tell me how to make a window non resizeable?

You have multiple issues here. First, you need to decide where you actually want to create the button, inside the main (game) window, or inside the tab window. Yes, when you create a tab control, it is actually its own window handle that gets drawn on top of the main window in which it is created (win_main, in this case.

Now, the way you are currently creating the button control is in the main window. You CAN do this, although then there is the issue of which control is on top, the button or the tab control. Now, you'd think it would be the button because obviously you can see it, but the tab may not be redrawing itself over top of the button. This is why you can see it but can't click on it, because you're actually interacting with the tab control. You can correct this by creating the button BEFORE the tab control, as controls with the Max WinAPI DLL are layered from top to bottom, with newest controls below.

However, the better choice (and the only way to get API_Control_SetAutoTab() to actually work), would be to create the control in the window handle of the tab. Note, this is NOT just the handle of the tab control itself, but instead the result returned by API_Control_GetHandle(). So, in code...
tab_main = API_Tab_Create(win_main,0,0,300,200)

tab_main_handle = API_Control_GetHandle(tab_main);//GET THE PARENT WINDOW HANDLE OF THE CONTROL.

API_Tab_SetMinWidth(tab_main,100)

API_Tab_InsertItem(tab_main,0,"TestTab1")//LEAVE THESE ALONE, AS THEY MODIFY THE ACTUAL CONTROL.
API_Tab_InsertItem(tab_main,1,"TestTab2")//SAME ^.

API_Control_SetAutoTab(0)

but_test0 = API_Button_Create(tab_main_handle,50,500,100,40,BS_CENTER)//CHANGE THIS LINE'S CREATION HANDLE.
API_Control_SetText(but_test0,"Enable List")
Open the example .GM6 file with the DLL and you'll see what I mean, as this is how he defines his controls.

To create a window that is not resizeable, change the window style flags you use when creating it. For example, use API_Window_Create(0, 100, 100, 640, 480, WS_CAPTION, 0).

Edited by LaLaLa, 09 August 2011 - 04:51 AM.

  • 0

#142 Glance

Glance

    GMC Member

  • GMC Member
  • 323 posts
  • Version:GM8

Posted 12 August 2011 - 04:53 PM

Hello, I've been trying to work with this dll since last night, but I just can't figure out a problem I'm having.

So I have an object in my room which controls WinAPI. In it's create event I have this:
API_Init();

Win = API_Window_Create(window_handle(),display_get_width()-192,0,192,256,0,0);
API_Window_SetFocus(window_handle());

The problem I'm getting is that it is creating two windows instead of one. Both are stacked on top of each other.
After this code executes, I have three windows on the screen; the main game window and the two windows that were created.
Does anyone know why this might be happening? I'm using GM8.0 and running 64bit Win7.

EDIT:
Wow, nvm. I never felt so stupid, I accidentally created two of the gui objects in the room. :wacko:

Edited by Glance, 12 August 2011 - 08:09 PM.

  • 0

#143 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1417 posts
  • Version:Unknown

Posted 19 January 2012 - 10:50 PM

why does the GEX versioin not have a API_Listview_SetSel function
  • 0

#144 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 28 January 2012 - 04:21 AM

why does the GEX versioin not have a API_Listview_SetSel function

Have you posted this issue on the topic for the GEX? Otherwise, there is no way for it to be fixed (unless you feel like recreating a GEX wrapper for this DLL all by yourself).
  • 0

#145 Bignutz

Bignutz

    GMC Member

  • GMC Member
  • 23 posts
  • Version:GM8

Posted 15 March 2012 - 01:17 PM

Hey im pretty good at using all the functions in this dll but as there is a help file missing regarding image lists i was wondering if any1 might know what the 4 arguments are for the API_ImageList_Create(). My guess is argument0: window_handle, arg1: file type? arg2:width arg3: height. but im not sure...
  • 0

#146 legocjman

legocjman

    Soldier of Christ

  • GMC Member
  • 543 posts
  • Version:GM:Studio

Posted 16 March 2012 - 03:04 AM

Download appears to be broken.
  • 0

#147 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • Retired Staff
  • 9259 posts
  • Version:Unknown

Posted 17 March 2012 - 06:48 PM

Quick question: how would I link a scrollbar to a richedit textbox? There doesn't seem to be an automatic way to do it, the example doesn't show it, and the Help file doesn't even list a way to get the scroll position of a richedit box at all (only set it?). I need my users to be able to enter text into a multiline richedit box while still being able to scroll around it...

-IMP
  • 0

#148 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 19 March 2012 - 09:12 PM

Quick question: how would I link a scrollbar to a richedit textbox? There doesn't seem to be an automatic way to do it, the example doesn't show it, and the Help file doesn't even list a way to get the scroll position of a richedit box at all (only set it?). I need my users to be able to enter text into a multiline richedit box while still being able to scroll around it...

-IMP

You can set the style of the control to the window scrollbar flag (WS_VSCROLL or something), and that should add a scroll bar. Unfortunately, there's no way to get its position, only the position of the cursor in the edit control.
  • 0

#149 ChaosMaker

ChaosMaker

    GMC Member

  • GMC Member
  • 288 posts
  • Version:GM:HTML5

Posted 13 April 2012 - 01:44 AM

the function API_Control_Destroy seems not working.

how remove the controls ?





  • 0

#150 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 13 April 2012 - 04:15 AM

the function API_Control_Destroy seems not working.

how remove the controls ?


Are you sure it's not gone but the background is dirty with it's image remnents...

This should work...
API_Window_Destroy(API_Control_GetHandle(ctrl));
  • 0

#151 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 15 April 2012 - 06:31 PM

This should work...
API_Window_Destroy(API_Control_GetHandle(ctrl));

It's already been established that you cannot destroy controls. API_Control_Destroy() doesn't do what it's supposed to, or apparently anything for that matter. The only way to "get rid" of a control is to hide it using API_Control_Show(control_handle, false).

As for the idea of using API_Window_Destroy(), wouldn't that also destroy any other controls that were assigned the same window handle (which should be pretty much anything else you created)?

EDIT: I tested your idea and it does actually work correctly. It destroys only that one control and clears it from the screen. Apparently each control gets a unique handle and has a unique window handle also created for it, separate from the parent window handle parameter (seems stupid, but whatever). I wonder if there is a memory leak, though, as the actual control might not be destroyed. Perhaps call API_Control_Destroy() and then API_Window_Destroy(), after first getting the control's window handle.

Edited by LaLaLa, 15 April 2012 - 06:40 PM.

  • 0

#152 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 15 April 2012 - 06:53 PM

EDIT: I tested it and it does actually work correctly (surprising). It destroys only that one control and clears it from the screen. Apparently each control gets a unique handle and has a unique window handle also created for it, separate from the parent window handle parameter (seems stupid, but whatever).


It's always been the way Windows worked. most everything in Windows is a window with flags and messages (sent to the parent). controls are extensions of the basic Window class. With extra flags specific to the control type and specific messages to respond to.

You can move the control with the base class window functions. You can also properly get the text of the rich text box with the API_Window_GetText(API_Control_GetHandle(ctrl)) because the API_RichEdit_GetText is defective as well.

I will point out it is better to simply hide the control and reuse it though. I had some unexpected hangs when destroying and re-creating controls
  • 0

#153 Un_t0uch

Un_t0uch

    GMC Member

  • GMC Member
  • 826 posts

Posted 17 April 2012 - 07:38 PM

Download link appears to be broken, any mirrors?
  • 0

#154 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 17 April 2012 - 07:53 PM

Download link appears to be broken, any mirrors?


you can grab the GEX version here
http://gmc.yoyogames.com/index.php?showtopic=426993&hl=Max+Winapi
  • 0

#155 Razon

Razon

    GMC Member

  • GMC Member
  • 246 posts
  • Version:Unknown

Posted 02 May 2012 - 03:35 PM

Here's the original DLL version of it.

http://www.mediafire...oxrqasss9egffqp

Edited by Razon, 02 May 2012 - 03:36 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users