The online racing simulator
Opening text entry dialog directly or by keyboard shortcut
Edit:
Ouch, am I green or what. I intended to post this in the general programmer forum. Forum admin, could you please delete it from here? Thanks and sorry for the noise.

Edit2: Okay, this thread is the one to stay. Here we go.

****
Is it possible to open the text entry dialog directly (without clicking on a button first)?

If not, is there a way to activate ("click on") a button by an Alt+ or Ctrl+ key combination/shortcut? In that case I could create an "invisible" button, and assign the shortcut to that.


What I'm trying to accomplish is this: by pressing a keyboard shortcut (or a wheel button) a text entry dialog should come up with some text already typed in.
I moved it for you.
Quote from Dygear :I moved it for you.

Thanks. But now there's two of them, because I double posted. That was mistake No 2, I guess. Sorry.

Can you delete this thread, so the other remains intact (no answer in either)? Thank you.
I don't have mod access out here, one of the other mods can merge this thread or delete it outright.
Sweet Jesus, dear admin, you deleted the *other* one instead of this. (Or was it merged, so the housekeeping conversation appears here?) Oh well, me and my adventures...

Okay, on topic then.

I've discovered a couple of potential approaches to this problem. Still not perfect, but getting there.

The first one was, since I didn't really need the pre-typed in message to be editable, I just wanted a "confirm" button (the message is supposed to be an admin command with the actual player's name). So I created a "compound" button, just like the message entry dialog, without the text field: nice big "Cancel" and "OK" buttons side by side, over a common background button. A picture serves better:

My only problem with this is that I have to use the mouse for pressing the buttons. I'd rather like if Enter worked for OK, Esc for Cancel, just like for the text entry Dialog.
How can I do that?


In the meantime, I've discovered, that I can send a "/press T" message, which results in the message entry dialog box popping up. I still have to figure out though, how to put my message into the textfield.

I've tried sending consecutive "/press a" "/press b" etc. commands, but the letters didn't end up in the textfield.

Sending "/ctrl v" after putting my message to system clipboard does fill the textfield, so it's almost perfect. Almost, because escape codes are shown instead of being interpreted.
I'm not sure if LFS clipboard allows escape coded text to be copied in-out...
I was exploring my "/press T"->show message entry dialog->type in text idea.

Since the clipboard technique doesn't work for escaped characters, I had another idea of simulating keyboard presses from my program.

I can "type" into the message box, I can even "press" Ctrl+1-9 for color codes.

However, I can't change codepages from keyboard only (by key combinations), so I'm stuck again.


Any other idea, how could I put text into the dialog (with colors/codepages/escaped characters correctly appearing)?
Since all three approaches I devised so far leave something to be desired, I think I will go with a fourth one, which goes like this.

1. User presses wheel button (assigned to a "/o mycommand" text command, also with an Alt+ or Ctrl+ keyboard combination)
2. A non-clickable button comes up with the feedback. This serves as a confirmation and sports a countdown back from (let's say) five to zero by the second.
3. If user presses the wheel button again before this button disappears, the confirmed command will go through, otherwise nothing happens.

Nice or what.
Well, this conversation turned out to be somewhat single-sided, but I hope that it will help someone someday.

I've changed my latest method (I believe this will be the last change) so that
- at one wheel button press the feedback button (which rather serves as a label) appears and stays permanently on screen, until either
- the same wheel button is pressed which executes my customized admin command
- another wheel button is pressed, which revokes the action.

This makes it possible to wait for the very last moment (e.g. with a !spec command) not worrying about the timer. And if it's not necessary, just dismiss the warning without taking any action.

FGED GREDG RDFGDR GSFDG