Jump to content


Photo

Max Winapi 2


  • Please log in to reply
154 replies to this topic

#121 shortline

shortline

    GMC Member

  • New Member
  • 26 posts

Posted 28 November 2010 - 01:32 AM

@Shortline
Try and avoid multi-line edit boxes in this dll, there's quite a few issues.


Thanks Krisando. Any chance you can recommend a dll or gex that handles multi-line edit boxes?
  • 0

#122 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 28 November 2010 - 01:56 AM


@Shortline
Try and avoid multi-line edit boxes in this dll, there's quite a few issues.


Thanks Krisando. Any chance you can recommend a dll or gex that handles multi-line edit boxes?

Sorry, haven't really looked into other alternatives for it. Most uses requiring multi-lines (coding, custom syntax) I can do just by opening a file with a common editor or by embedding it in the Window. Since It's rich text you may be able to insert a new line character, or new line tag (Many rich text interpreters work with standard html formatting tags). Sorry couldn't be of more help.
  • 0

#123 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 09 December 2010 - 03:57 AM



@Shortline
Try and avoid multi-line edit boxes in this dll, there's quite a few issues.

Thanks Krisando. Any chance you can recommend a dll or gex that handles multi-line edit boxes?

Sorry, haven't really looked into other alternatives for it. Most uses requiring multi-lines (coding, custom syntax) I can do just by opening a file with a common editor or by embedding it in the Window. Since It's rich text you may be able to insert a new line character, or new line tag (Many rich text interpreters work with standard html formatting tags). Sorry couldn't be of more help.

While there are a few issues with multi-line edit boxes, they are all just the control not clearing the background and re-redering itself when needed. An easy fix for this is whenever you recieve a check message from the control (regardless of whether anything actually changed), just store the current selection, select everything which forces a redraw, and then reset the selection (which forces another redraw). This little work-around is short, works well, and is the only simple solution I have found.

The only "issue" is that the text flashes somewhat when typing a lot repeatedly, such as holding down a key or deleting a bunch of stuff, but it's still okay. Anyway, here is the code I use:
var_temp[0] = API_Edit_GetSel(var_edit_awards, 0);
var_temp[1] = API_Edit_GetSel(var_edit_awards, 1);
API_Edit_SetSel(var_edit_awards, 0, string_length(API_Control_GetText(var_edit_awards)));
API_Edit_SetSel(var_edit_awards, var_temp[0], var_temp[1]);

Edited by LaLaLa, 05 May 2011 - 11:25 PM.

  • 0

#124 shortline

shortline

    GMC Member

  • New Member
  • 26 posts

Posted 09 December 2010 - 10:09 PM

While there are a few issues with multi-line edit boxes, they are all just the control not clearing the background and re-redering itself when needed. An easy fix for this is whenever you recieve a check from the control (regardless of whether anything actually changed), just store the current selection, select everything which forces a redraw, and then reset the selection (which forces another redraw). This little workaround is short, works well, and is the only simple solution I have found. The only "issue" is that the text flashes somewhat when typing a lot repeatedly, such as holding down a key or deleting a bunch of stuff, but it's still okay. Anyway, here is the code I use:

var_temp[0]=API_Edit_GetSel(var_edit_awards,0);
var_temp[1]=API_Edit_GetSel(var_edit_awards,1);
API_Edit_SetSel(var_edit_awards,0,string_length(API_Control_GetText(var_edit_awards)));
API_Edit_SetSel(var_edit_awards,var_temp[0],var_temp[1]);


Thank you very much, LaLaLa. That's helpful. Might have to do that.
  • 0

#125 rram

rram

    GMC Member

  • GMC Member
  • 1 posts

Posted 10 January 2011 - 08:51 PM

Hey, totally cool dll,

But have a problem with the "API List View",
when I make a user list with columns firstname, lastname, phone, street, etc.
and make some tables with data, i cannot identify which table I have selected.
The only thing I can see is the location of the table in the list.

I need a function like API_Listview_GetData(Real Control ID, column-name) example: API_Listview_GetDataSelected(Listview1,"Firstname");

This is my code.

Object0: Create
    Listview1 = API_Listview_Create (win,10,150,room_width-20,300,LVS_REPORT,WS_EX_CLIENTEDGE);
    
    API_Listview_SetExtendedStyle (Listview1,LVS_EX_FULLROWSELECT);
    
    API_Listview_InsertColumnText (Listview1,0,100,"Firstname");
    API_Listview_InsertColumnText (Listview1,1,100,"Lastname");
    API_Listview_InsertColumnText (Listview1,2,100,"CPR-NR");
    API_Listview_InsertColumnText (Listview1,3,100,"Phone 1");    
    API_Listview_InsertColumnText (Listview1,4,100,"Phone 2");
    API_Listview_InsertColumnText (Listview1,5,100,"Street");

            
    MySQL_Query (Handle,"SELECT fornavn, efternavn, cprnr, telefon1, telefon2, adresse FROM klienter");
    Result = MySQL_ResultStore (Handle);
    rows = MySQL_NumRows (Result);
    fields = MySQL_NumFields (Result);
    iii = 0;
    repeat (rows)
    {
    row = MySQL_RowFetch (Result);
    for (i=0;i<fields;i+=1)
    {
    data = MySQL_RowGetField (row,i);
    API_Listview_InsertItemText (Listview1,i,iii,data);

    }
    iii+=1;
    Listview1Antal=iii;
    }
    MySQL_ResultFree (Result);
Object0: Step

i=0;
while(i<Listview1Antal)
{
if (API_Listview_GetSelected(Listview1,i))
{
chosen = i;
}
i+=1;
}

Object0: Draw

draw_text(10,50,'The chosen user id: '+string(chosen))


Running:

First i choose Helle, then the id = 1;
Posted Image


Then i choose Thomas, the the id = 2;
Posted Image


Now i press at "Firstname" and the list sort after that! nice! but... problem..

Now i choose Helle again, but now the id = 3;
Posted Image


Then i choose Thomas again, and the id = 0;
Posted Image



Thanks for your help !
  • 0

#126 OMGCarlos

OMGCarlos

    GMC Member

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

Posted 14 January 2011 - 10:03 PM

I tried creating a Help menu item to show the game info, show_info(). But I get a series of "Access Violations" to the MaxWinAPI.dll and RICHED20.dll. This is the code I used:

com = API_Check_Command(1); //Check for new commands

/* Menu Commands */
//Show the help file
if com == mnuMain_File_Help then show_info();

I also tried creating a variable and launching "show_info()" from another object, but still get the error. I even get the error if I press F1.
  • 0

#127 jlsnews

jlsnews

    GMC Member

  • GMC Member
  • 3 posts

Posted 19 January 2011 - 01:48 PM

Sorry, DLL confused ...

Please delete post!

Edited by jlsnews, 19 January 2011 - 01:51 PM.

  • 0

#128 Fener

Fener

    GMC Member

  • New Member
  • 2 posts

Posted 20 January 2011 - 04:28 PM

Nothing anymore...

Edited by Fener, 20 January 2011 - 07:12 PM.

  • 0

#129 KOOPA

KOOPA

    GMC Member

  • GMC Member
  • 463 posts
  • Version:GM8

Posted 30 January 2011 - 04:05 AM

How Do I Open a Text file into the winapi box
  • 0

#130 OHU

OHU

    GMC Member

  • New Member
  • 16 posts

Posted 01 February 2011 - 02:32 PM

The link to the online documentation of the functions doesn't work.
  • 0

#131 Hummer

Hummer

    GMC Member

  • New Member
  • 2 posts

Posted 02 May 2011 - 03:50 PM

Hi users! I'm from other country and I have not excellent English. Don't laught, please!
I have problem with this dll
I have this code
=Create=
API_Init()
win=window_handle()
API_Check_Set(1, win)
test=API_Button_Create(win, 0, 0, 100, 20, BS_NOTIFY)
mode=false
=Step=
cl=API_Check_Command(1)
if(cl=test)
{
mode=!mode
}
if(mode)
{
API_Control_SetPos(test, mouse_x, mouse_y)
}
When the game starts and I move mouse down AND right, I see this:
Posted Image
Can you help me? It'll be good!

Edited by Hummer, 03 May 2011 - 01:29 AM.

  • 0

#132 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 02 May 2011 - 09:58 PM

The link to the online documentation of the functions doesn't work.

If you'd bothered to download and open the ZIP file from the website, you'd notice that all the documentation is within the Help folder. :whistle:

By the way, your sig is weird and possibly creepy, depending on your age. :unsure:

Thumbs up if you think Miley Cyrus is hooooooot!!


Edited by LaLaLa, 05 May 2011 - 11:33 PM.

  • 0

#133 Hummer

Hummer

    GMC Member

  • New Member
  • 2 posts

Posted 05 May 2011 - 07:53 AM

Can you help me? My project stopped with this problem! Please!
  • 0

#134 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 05 May 2011 - 11:03 PM

Can you help me? My project stopped with this problem! Please!

First, you shouldn't post your question here. Use the Novice and Intermediate Users forum instead.

As for your problem, I'm not sure what the issue is. There is a black border around the button because you have the "Color outside the room region" set to black under the Global Game Settings. Controls are created with this as their background color, so you should change it to rgb(240, 240, 240). Also, the button is blue because you are constantly moving it under the mouse, so it is being hovered over and therefore glowing. As for the weird cropping of the top and left, I'm not sure what's causing that. If I were you, I'd try getting it to work without moving the button around.

Edited by LaLaLa, 05 May 2011 - 11:30 PM.

  • 0

#135 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 05 May 2011 - 11:19 PM

How Do I Open a Text file into the winapi box

Again:

First, you shouldn't post your question here. Use the Novice and Intermediate Users forum instead.

You need to read a text file and then set the text of the edit control to that text. In GML, this would be:
{
    var_edit_textFileDump = API_Edit_Create(window_handle(), 10, 10, 400, 300, ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE);// Create the large editable control.
    
    var_file_handle = file_text_open_read("C:\File_Name_Here.txt");// Open your text file for reading (replace the name with the file you want to read).
    while(!file_text_eof(var_file_handle))// Continue reading line by line until you get to the last line of the file.
    {
        API_Control_SetText(var_edit_textFileDump, API_Control_GetText(var_edit_textFileDump) + file_text_read_string(var_file_handle) + "
");// Append the next line of text to the edit control's text, along with a line-break.
        file_text_readln(var_file_handle);// Move to the next line within the file.
    }
    file_text_close(var_file_handle);// Close the file once done.
}

Edited by LaLaLa, 05 May 2011 - 11:37 PM.

  • 0

#136 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 05 May 2011 - 11:56 PM

I tried creating a Help menu item to show the game info, show_info(). But I get a series of "Access Violations" to the MaxWinAPI.dll and RICHED20.dll.

Where is the example code located? Is it in a Draw event?

The only reason I can think for there to be access violations is if you are checking a window slot for command messages before you set the check. In your Create event, you need to call API_Check_Set(1, window_handle());. Have you done this?
  • 0

#137 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 06 May 2011 - 12:47 AM

Hey, totally cool dll,

But have a problem with the "API List View",
when I make a user list with columns firstname, lastname, phone, street, etc.
and make some tables with data, i cannot identify which table I have selected.
The only thing I can see is the location of the table in the list.

I need a function like API_Listview_GetData(Real Control ID, column-name) example: API_Listview_GetDataSelected(Listview1,"Firstname");

I'm suprised that you didn't figure this out yourself, considering you were able to create the user interface and that MySQL code. The issue is that when you read the item number that is selected in a listview, it gives you the literal number, starting from 0 at the top and increasing downwards. Obviously this is normally the same as the order in which you create the items, until the user clicks on a column to sort it, which throws everything off.

If you need to know which actual person is selcted, you have two options.

The first is to just not allow the user to sort the list, which is what I often do, because it's not worth dealing with possible reording. Not only do you have issues trying to find what item is selected (and it's value), but you have to change things if you want to modify data later, say if you need to change "John's phone number" as you no longer know where it is located.

Your second option is to include another column with each row which will store a unique ID. You could even make this column 0px wide so the user can't see it. Then when you look at which row is selected, you can access that item's unqiue ID (which moves with the row when it is sorted), so you can tell what is where. Also, depending on how you are telling which "table" is selcted, you can base it off the first name or another column, but that could get messy. You can also loop through all rows to find out where a certain item is currently located, searching for an ID or other value.

Edited by LaLaLa, 06 May 2011 - 12:57 AM.

  • 0

#138 iceshield

iceshield

    GMC Member

  • GMC Member
  • 393 posts

Posted 24 May 2011 - 06:52 PM

Where can I find some documentation so I can know how to use this ? (online documentation link is broken :() The example is too complex
  • 0

#139 LaLaLa

LaLaLa

    GMC Member

  • New Member
  • 511 posts
  • Version:GM8

Posted 24 May 2011 - 10:20 PM

Where can I find some documentation so I can know how to use this ? (online documentation link is broken :() The example is too complex

It's apparent that people don't read other posts before they post. As I said to another individual, you just need to download the actual example (which it sounds like you've done) and open the Help folder in the Zip file, which somehow you didn't see? The online documentation was the exact same thing, just online.

If you'd bothered to download and open the ZIP file from the website, you'd notice that all the documentation is within the Help folder. :whistle:

Also, the example isn't that complex. There's just a lot of code because it shows pretty much every control that the DLL can create. Just creating a little application window with some buttons is fairly easy. You only need API_Init(); and API_Button_Create(); ;)

Edited by LaLaLa, 24 May 2011 - 10:23 PM.

  • 0

#140 Rhutos

Rhutos

    GMC Member

  • GMC Member
  • 3 posts

Posted 19 June 2011 - 06:30 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?

Edited by Rhutos, 19 June 2011 - 06:47 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users