Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: juncmodule on Thu 04/12/2003 23:35:27

Title: ListBox, Mouse click, keycode questions...
Post by: juncmodule on Thu 04/12/2003 23:35:27
How do I make these work?

up arrow and down arrow to scan through selected items...
 //if (keycode==372)   ListBoxSetSelected(3,0,-1);
 //if (keycode==380)   ListBoxSetSelected(3,0,+1);

press enter selects the item
 //if (keycode==13)    on_mouse_click(LEFT);

I know that the "enter" one isn't even close. Is it possible to simulate a click in AGS? This seems familiar and I was thinking that you can't.

The arrow key question is stupid and I should know how to make it work...but...I'm stupid.

later,
-junc
Title: Re:ListBox, Mouse click, keycode questions...
Post by: Scorpiorus on Thu 04/12/2003 23:44:25
Hello junc,

the 1st one:

if (keycode==372) ListBoxSetSelected(3,0,ListBoxGetSelected(3,0)-1);
if (keycode==380) ListBoxSetSelected(3,0,ListBoxGetSelected(3,0)+1);


As about the second what do you mean with "selects the item"? :P
Title: Re:ListBox, Mouse click, keycode questions...
Post by: juncmodule on Thu 04/12/2003 23:51:29
1st one:

Thanks Scorp! I knew it was easy... ::)

2nd one:

Basically whenever the player presses enter it would be just like the left mouse button has been pressed.

Now that I think of it, it may need to be a little more complex than that...perhaps everytime enter is pressed the cursor would have to be repositioned to the selected text box item, and then the LEFT mouse click simulated...?? That would make more sense...

eh,
-junc

EDIT: Nevermind, I figured out a better way to do it, I just check the selected box everytime enter is pressed ::).

Just out of curiosity though, can you simulate mouse clicks via scripting? I know you can detect them via on_mouse_click...
Title: Re:ListBox, Mouse click, keycode questions...
Post by: Scorpiorus on Fri 05/12/2003 00:13:49
QuoteEDIT: Nevermind, I figured out a better way to do it, I just check the selected box everytime enter is pressed ::).
Yeah, that is why I asked a question as it already highlighted. So, yeah you just get a number and retrieve the listbox string or whatever. :P

QuoteJust out of curiosity though, can you simulate mouse clicks via scripting? I know you can detect them via on_mouse_click...
ProcessClick() is suitable for background clicking. As about GUI's its more difficult if not impossible. So you can't simulate a click on listbox option that easy.

~Cheers
Title: Re:ListBox, Mouse click, keycode questions...
Post by: Ishmael on Sat 06/12/2003 14:51:37
but you can run on_mouse_click(), interface_click(), on_key_press() etc in scripts. I've done that with inteface_click()
Title: Re:ListBox, Mouse click, keycode questions...
Post by: Scorpiorus on Sat 06/12/2003 15:05:26
Yes, thus you call an event function (that is the result of the click) but take for example a listbox. How can you set the listbox cursor position? It's processed internally by AGS. :P Actually, it can be done but would require some scripting. Another, example, when you press a GUI button which has a mouseover image. You have to simulate that as well. etc...

~Cheers
Title: Re:ListBox, Mouse click, keycode questions...
Post by: Ishmael on Sat 06/12/2003 15:31:08
Ain't there a SetMousePosition(x,y) function? :P
Title: Re:ListBox, Mouse click, keycode questions...
Post by: Scorpiorus on Sat 06/12/2003 15:40:54
No, no I mean the listbox cursor... when you click on listbox AGS highlights the mouse over option. You have to calculate that option. The same goes to slider. It's possible but takes an extra effort.

PS for the listbox however you have to know its options font size. :P