Text entry on click button - Forum

Forum Navigation
You need to log in to create posts and topics.

Text entry on click button

Clicking a button with a text saved in a variable I would like to write it in a selected text entry. who helps me?

@sinesi-giuseppe

Say, you have previously populated variable [sometext] like so ...

SetVar "[someText]" "VisualNEOWin"

Assuming that the Variable: (to store TextEntry contents) for TextEntry15 is defined as [TextEntry15], in order to populate this box ...

SetVar "[TextEntry15]" "[someText]"

 

that's not what I was asking, I have many tex entries, when I select them with the mouse I wanted that by pressing some buttons these automatically inserted texts

@gigi

Sorry, I don't understand; something is getting lost in translation.

1) when you say many tex entries, are you referring to entries in a ListBox ?

2) when you say automatically inserted texts, do you want the selected ListBox entry to be inserted in a Text (or TextEntry) object ? ... if TextEntry object, where do you want it to be inserted ? (beginning, end or at current insertion point ?)

Perhaps you can elaborate with a screenshot and some arrows and text ? ... or post a simple pub file with notes about what you wish to happen.

this is example. Thank

Uploaded files:
  • You need to login to have access to uploads.

You need the plugin Editor's Toolbox v1. 75

@sinesi-giuseppe

Thank you for the pub that explains your requirement.

I have a solution ... but before I post it here, can you advise ...

a) when you say when I select the text entry and click the button it will insert the (chosen) text inside the text entry, is the chosen text "Hello" or "House"(depending on which button is clicked ? ... or something else ?

b) I notice that each of your TextEntry boxes (CasellaImmissioneTesto1, CasellaImmissioneTesto2, CasellaImmissioneTesto3 and CasellaImmissioneTesto4) specify the same value (i.e. [CasellaImmissioneTesto1]) for Variable: (to store TextEntry contents) ... I am assuming this is just an error (you probably created the other 3 boxes by Duplicating the first one ... if all boxes have the same associated variable, when you populate this variable with a value, it will show up in all 4 TextEntry boxes ... please confirm that each box should have a different associated variable.

 

 

@gaev

I have a solution ...

Exactly. There is also an opportunity to get the selected text.

GetObjectInfo "" "SelectedText" ""

:)

@mishem

Exactly. There is also an opportunity to get the selected text.
GetObjectInfo "" "SelectedText" ""

What I am unclear about is when @sinesi-giuseppe says "chosen text" ... where is this chosen text ? ...

a) if it is in a variable or it is the label of the button, the solution is simple

b) if it is the content of a Text Box, it is still possible

c) if it is a (selected) part of a Text Box, it may not be possible ... according to the help file for GetObjectInfo ... SelectedText can be used to copy highlighted from Text Entry or Article objects ... NOT Text Boxes

excuse me, let me explain better, selecting with the mouse and clicking on the textentry 1 box I have the cursor flashing, clicking on button 1 I would like to assign them a text to paste in the selected text entry......

Uploaded files:
  • You need to login to have access to uploads.

@gaev

What I am unclear about is when

I don't understand him either. :)

@sinesi-giuseppe

It is necessary? Or something different?

 

Uploaded files:
  • You need to login to have access to uploads.

@sinesi-giuseppe

let me explain better, selecting with the mouse and clicking on the textentry 1 box I have the cursor flashing, clicking on button 1 I would like to assign them a text to paste in the selected text entry......

The solution (textentry2.pub) posted by @mishem appears to be what I understand you wanted.

Please note ...

a) the key is this code in the GainFocus event section of each of the TextEntry Boxes

SetVar "[Focus]" "[Self]"

b) instead of having one Button for each piece of text (with hard-coded values in each Button), you might consider using a single ListBox (with each entry representing some text) ... then, the user can just select the required entry ... the values of each entry can be hard coded at design time or dynamically loaded at run time from (say) a text file.

Not exactly what I was looking for but a great starting point for my work. Thank you all