ListBox, Mouse click, keycode questions...

Started by juncmodule, Thu 04/12/2003 23:35:27

Previous topic - Next topic

juncmodule

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

Scorpiorus

#1
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

juncmodule

#2
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...

Scorpiorus

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

Ishmael

but you can run on_mouse_click(), interface_click(), on_key_press() etc in scripts. I've done that with inteface_click()
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scorpiorus

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

Ishmael

Ain't there a SetMousePosition(x,y) function? :P
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scorpiorus

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

SMF spam blocked by CleanTalk