If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby: how to force editbox to close?
7 posts
• Page 1 of 1
Ruby: how to force editbox to close?
Here is the thing... I what to use editbox to detect keyboard input and string pasting - to detect last tiped character / pasted string. Only way I know how to do that is to create new empty editbox, every time the content changes. However, it is not possible to create new edit box while an existing edit box is active. Is there a way to force edit box to close from inside ruby? AFAIK, it closes only when tab/enter is pressed or you click away.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Ruby: how to force editbox to close?
I don't know how it can be close via code.
Only other thing I can think may be of some use is the "isKeyPressed()" method to detect when keys are pressed,but it is not really suitable for this task I don't think.
Only other thing I can think may be of some use is the "isKeyPressed()" method to detect when keys are pressed,but it is not really suitable for this task I don't think.
- Exo
- Posts: 426
- Joined: Wed Aug 04, 2010 8:58 pm
- Location: UK
Re: Ruby: how to force editbox to close?
I am going quite a similar route for the editor I want to do for your dsp/asm²
isKeyPressed does not work everywhere. It is bound to mouse actions. However, I could regularly open a new editbox each time the user enters the view with the mouse - without closing the previous one. And there were no issues. I did it with Ruby, if that makes a difference.
What would really be needed is a way to catch keystrokes before Flowstone interprets them, and flush them after use. Just like the MIDI key from pc keyboard input.
isKeyPressed does not work everywhere. It is bound to mouse actions. However, I could regularly open a new editbox each time the user enters the view with the mouse - without closing the previous one. And there were no issues. I did it with Ruby, if that makes a difference.
What would really be needed is a way to catch keystrokes before Flowstone interprets them, and flush them after use. Just like the MIDI key from pc keyboard input.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby: how to force editbox to close?
Here is, what I have so far... Scroll bars do not interact yet (you may scroll the text by dragging selections - view is adjusted so that cursor is always on screen) and also cursor does not react while editing text. Both of these are easy to add (I will do it in near future).
the editor has multiple parts, of which only the actual text editor is implemented.Top and bottom bars are empty yet, but will contain dropdown menus tabs and will show various data.
The code is drawn on screen char by char into a grid (because I was unable to determine line height and char width from font size or font itself, but that's another topic).
My first try was, to re-initiate edit box as empty, every time something is tiped in or pasted in. delete and backspace would be implemented separately if possible (as well as enter and tab which I've already done, because they cause edit box to close).
What is your approach Tulamide? Do you use edit box with transparent text and background and draw colored text underneath?
the editor has multiple parts, of which only the actual text editor is implemented.Top and bottom bars are empty yet, but will contain dropdown menus tabs and will show various data.
The code is drawn on screen char by char into a grid (because I was unable to determine line height and char width from font size or font itself, but that's another topic).
My first try was, to re-initiate edit box as empty, every time something is tiped in or pasted in. delete and backspace would be implemented separately if possible (as well as enter and tab which I've already done, because they cause edit box to close).
What is your approach Tulamide? Do you use edit box with transparent text and background and draw colored text underneath?
- Attachments
-
- DSPcodeEditor.fsm
- (4.37 KiB) Downloaded 783 times
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Ruby: how to force editbox to close?
KG_is_back wrote:What is your approach Tulamide? Do you use edit box with transparent text and background and draw colored text underneath?
Basically yes, just that I didn't make it transparent but offsetted it far outside the view (in fact even outside any possible screen size). I also did use it per key stroke. But you are far more advanced in that you already solved the text cursor positioning to a degree (that was my biggest issue). You would just need to take into account that backspace should delete also outside of the current edit box' text.
Tbh, I feel relieved that you are already so far, because I got the great opportunity to help with an awesome project. Since last week I spend all my time on that project, and so the editor didn't progress, which made me feel uneasy. Now that I know you're doing the same and already advanced, I can concentrate on the project unvexed
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby: how to force editbox to close?
Hi KG,
Had a moment to load up your DSPCodeEditor example, and noticed a complaint from RUBY
Located in the 'full code edit' module, the inside RUBY block give a
"NoMethodError [in method event]: 'undefined method 'setViewSize'.
I should note that I'm running FS 3.0.4
I can reset that RUBY box, but the error returns when clicking on the main GUI. Again, this might be a version error.
Had a moment to load up your DSPCodeEditor example, and noticed a complaint from RUBY
Located in the 'full code edit' module, the inside RUBY block give a
"NoMethodError [in method event]: 'undefined method 'setViewSize'.
I should note that I'm running FS 3.0.4
I can reset that RUBY box, but the error returns when clicking on the main GUI. Again, this might be a version error.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: Ruby: how to force editbox to close?
RJHollins wrote:Hi KG,
Had a moment to load up your DSPCodeEditor example, and noticed a complaint from RUBY
Located in the 'full code edit' module, the inside RUBY block give a
"NoMethodError [in method event]: 'undefined method 'setViewSize'.
I should note that I'm running FS 3.0.4
I can reset that RUBY box, but the error returns when clicking on the main GUI. Again, this might be a version error.
Yes, the method was added in 3.0.5. It can resize and reposition the view of a module.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 70 guests