Support

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?

For general discussion related FlowStone

Ruby: how to force editbox to close?

Postby KG_is_back » Mon Feb 16, 2015 7:38 pm

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?

Postby Exo » Mon Feb 16, 2015 11:23 pm

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.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: Ruby: how to force editbox to close?

Postby tulamide » Mon Feb 16, 2015 11:34 pm

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.
"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?

Postby KG_is_back » Tue Feb 17, 2015 8:08 pm

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?
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?

Postby tulamide » Wed Feb 18, 2015 2:56 am

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?

Postby RJHollins » Wed Feb 18, 2015 3:07 am

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.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Ruby: how to force editbox to close?

Postby KG_is_back » Wed Feb 18, 2015 8:09 am

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


Return to General

Who is online

Users browsing this forum: No registered users and 62 guests