ArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2024-12-24T11:44:28+02:00 https://brainmodular.org/forums/app.php/feed/topic/7071 2024-12-24T11:44:28+02:00 2024-12-24T11:44:28+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45640#p45640 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]> Statistics: Posted by senso — 24 Dec 2024, 10:44


]]>
2024-12-09T08:39:35+02:00 2024-12-09T08:39:35+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45608#p45608 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>

CODE:

////////////////////////////////////////////   //  SWITCH AS TEXT FADER  //  if you are tired of those tiny windows 95 text entry popups, try this.  It uses the text of//  the button, so you can make it as large as you like.  If the text will end up as the//  title of the button, you can also know whether it will fit...////  off text is typically the title.  when the user presses the switch//  the text shown is either what was last entered, or an empty string, depending //  on the state of 'clear existing'.//  'text to switch' is typically wired to the switch on caption, but could be wired//  to the switch off caption as well, to show the value even when it's off.//  since we don't have a cursor, a backspace will clear all the text.  Actually more convenient//  for short text, I think.//                     ////////////////////////////////////////////const ENTER = 13;const BACKSPACE = 8;const ESCAPE = 27;                          // Globally enable/disable logging const DTAG = 'TextButton: ';const DBUG_ON = TRUE;procedure debug(s: string); begin if DBUG_ON then strace(DTAG + s); end;procedure iDebug(s: string; num : integer); begin debug(s + '= ' + intToStr(num)); end;// parameters declaration                                            var switchIN, switchTextIN, keyNumIN, keyDownIN, offEntersIN, clearTextIN: tParameter;var textOUT, switchOffOUT, switchTextOUT: tParameter;var gText, gRevertText, gKeyin: string;var gKeynum: integer;var gLive,gSwitchedOff: boolean; // initialisation : create parametersprocedure init;var i : integer;                   begin                               SetModuleColor($804080+600000);      switchIN := CreateParam('switch in', ptSwitch, pioInput);    //if we start with existing text    switchTextIN := CreateParam('switch text', ptTextfield, pioInput);    keyNumIN := CreateParam('key num', ptDatafield, pioInput);         clearTextIN := CreateParam('clear existing', ptSwitch, pioInput);    switchOffOUT := CreateParam('set switch off', ptButton, pioOutput);    switchTextOUT := CreateParam('text to switch', ptTextfield, pioOutput);    //text to send on    textOUT := CreateParam('text out', ptTextfield, pioOutput);    gLive := FALSE;    gSwitchedOff := TRUE;    end;procedure processSwitch(state: integer);begin    if state = 0 then    //switch turned off    begin        gLive := FALSE;    end    else if (state = 1) then    //switch turned on    begin        if clearTextIN.asInteger = 0 then            gText := switchTextIN.asString            else gText := '';        switchTextOUT.asString(gText);        gRevertText := switchTextIN.asString;; //save this in case the user cancels.        gLive := TRUE;    endend;procedure processKey(keynum: integer);begin    //if the key is backspace, clear everything. We have no cursor, so this is how we do it    if keynum = BACKSPACE then    begin        gText := '';        switchTextOUT.asString(gText);    end    //if the key is enter, send the text to the output and turn off the button    else if keynum = ENTER then    begin        //button text will not need to be changed.... oh I guess it does.        textOUT.asString(gText);        switchTextOUT.asString(gText);        switchOffOUT.asInteger(1);        gSwitchedOff := TRUE;    end    //if the key is esc, clear the text and turn off the button    else if keynum = ESCAPE then    begin        //gText := '';        switchOffOUT.asInteger(1);        switchTextOUT.asString(gRevertText);        gSwitchedOff := TRUE;    end    //otherwise, add the key to buttonText and send it out.    else    begin          Debug('key ' + Chr(keynum));        gText := gText + Chr(keynum);        switchTextOUT.asString(gText);        gSwitchedOff := TRUE;    end;    //end;procedure Callback(n:integer);    begin    if n = switchIN then processSwitch(switchIN.asInteger)       else if (n =  keyNumIN) and (keyNumIN.asInteger > 0) and gLive then    begin       //we could store, and wait for zero (key up)       idebug('process key num',keyNumIN.asInteger);       processKey(keyNumIN.asInteger);    endend;// no process blocprocedure processIdle();begin    if gSwitchedOff then    begin        gSwitchedOff := FALSE;        switchOffOUT.asInteger(0);        textOUT.length(-1);        switchTextOUT.length(-1);    end;end;

Statistics: Posted by woodslanding — 09 Dec 2024, 07:39


]]>
2024-12-09T07:43:33+02:00 2024-12-09T07:43:33+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45607#p45607 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]> Statistics: Posted by woodslanding — 09 Dec 2024, 06:43


]]>
2024-12-09T03:48:48+02:00 2024-12-09T03:48:48+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45606#p45606 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
Also, Is there somewhere in the documentation where it is noted what actual version of pascal Usine uses? That would be nice information to know. I am always trying commands I find on the web, but they don't work in usine....

thanks!!!
-eric

Statistics: Posted by woodslanding — 09 Dec 2024, 02:48


]]>
2024-12-08T18:38:38+02:00 2024-12-08T18:38:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45603#p45603 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
Trying to figure this out...

Would sure be nice to have an 'is editing' output on the textfield....

Statistics: Posted by woodslanding — 08 Dec 2024, 17:38


]]>
2024-12-08T08:04:06+02:00 2024-12-08T08:04:06+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45601#p45601 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
This patch makes me unreasonably happy. A text fader that triggers on enter, even if the text is unchanged. So great!

Mouse in makes sure enter key doesn't have an effect unless the text is open for editing...

cheers!

Statistics: Posted by woodslanding — 08 Dec 2024, 07:04


]]>
2022-11-25T11:18:45+02:00 2022-11-25T11:18:45+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44497#p44497 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
ss key.png

Statistics: Posted by senso — 25 Nov 2022, 10:18


]]>
2022-11-25T08:03:35+02:00 2022-11-25T08:03:35+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44496#p44496 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
enterKey2.png
But this still has the problem that I cannot change the value of text 2, even when 'pass' is off. The pass output shows [-1], but the value still won't change.

Statistics: Posted by woodslanding — 25 Nov 2022, 07:03


]]>
2022-11-25T07:52:42+02:00 2022-11-25T07:52:42+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44495#p44495 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
enterKey.png
(for some reason, the 'key' output on the keyboard module is always zero.)

The problem here, which I never know how to solve, is that if I put a PIC module before the text 2 fader, then change the text 2 fader value, and want to update it back to the old text 1 value, the PIC module doesn't see a change, and nothing happens. If I don't add a PIC, then I can't change the value of text2 at all.

I encounter this kind of issue a lot, and I am trying to figure out a way around it.....

Statistics: Posted by woodslanding — 25 Nov 2022, 06:52


]]>
2022-11-25T07:33:38+02:00 2022-11-25T07:33:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44494#p44494 <![CDATA[Any way to know when Enter key is pressed on text fader?]]>
Thoughts?

Thanks!!!!

Statistics: Posted by woodslanding — 25 Nov 2022, 06:33


]]>
BrainModular BrainModular Users Forum 2024-12-24T11:44:28+02:00 https://brainmodular.org/forums/app.php/feed/topic/7071 2024-12-24T11:44:28+02:00 2024-12-24T11:44:28+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45640#p45640 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]> Statistics: Posted by senso — 24 Dec 2024, 10:44


]]>
2024-12-09T08:39:35+02:00 2024-12-09T08:39:35+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45608#p45608 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>

CODE:

////////////////////////////////////////////   //  SWITCH AS TEXT FADER  //  if you are tired of those tiny windows 95 text entry popups, try this.  It uses the text of//  the button, so you can make it as large as you like.  If the text will end up as the//  title of the button, you can also know whether it will fit...////  off text is typically the title.  when the user presses the switch//  the text shown is either what was last entered, or an empty string, depending //  on the state of 'clear existing'.//  'text to switch' is typically wired to the switch on caption, but could be wired//  to the switch off caption as well, to show the value even when it's off.//  since we don't have a cursor, a backspace will clear all the text.  Actually more convenient//  for short text, I think.//                     ////////////////////////////////////////////const ENTER = 13;const BACKSPACE = 8;const ESCAPE = 27;                          // Globally enable/disable logging const DTAG = 'TextButton: ';const DBUG_ON = TRUE;procedure debug(s: string); begin if DBUG_ON then strace(DTAG + s); end;procedure iDebug(s: string; num : integer); begin debug(s + '= ' + intToStr(num)); end;// parameters declaration                                            var switchIN, switchTextIN, keyNumIN, keyDownIN, offEntersIN, clearTextIN: tParameter;var textOUT, switchOffOUT, switchTextOUT: tParameter;var gText, gRevertText, gKeyin: string;var gKeynum: integer;var gLive,gSwitchedOff: boolean; // initialisation : create parametersprocedure init;var i : integer;                   begin                               SetModuleColor($804080+600000);      switchIN := CreateParam('switch in', ptSwitch, pioInput);    //if we start with existing text    switchTextIN := CreateParam('switch text', ptTextfield, pioInput);    keyNumIN := CreateParam('key num', ptDatafield, pioInput);         clearTextIN := CreateParam('clear existing', ptSwitch, pioInput);    switchOffOUT := CreateParam('set switch off', ptButton, pioOutput);    switchTextOUT := CreateParam('text to switch', ptTextfield, pioOutput);    //text to send on    textOUT := CreateParam('text out', ptTextfield, pioOutput);    gLive := FALSE;    gSwitchedOff := TRUE;    end;procedure processSwitch(state: integer);begin    if state = 0 then    //switch turned off    begin        gLive := FALSE;    end    else if (state = 1) then    //switch turned on    begin        if clearTextIN.asInteger = 0 then            gText := switchTextIN.asString            else gText := '';        switchTextOUT.asString(gText);        gRevertText := switchTextIN.asString;; //save this in case the user cancels.        gLive := TRUE;    endend;procedure processKey(keynum: integer);begin    //if the key is backspace, clear everything. We have no cursor, so this is how we do it    if keynum = BACKSPACE then    begin        gText := '';        switchTextOUT.asString(gText);    end    //if the key is enter, send the text to the output and turn off the button    else if keynum = ENTER then    begin        //button text will not need to be changed.... oh I guess it does.        textOUT.asString(gText);        switchTextOUT.asString(gText);        switchOffOUT.asInteger(1);        gSwitchedOff := TRUE;    end    //if the key is esc, clear the text and turn off the button    else if keynum = ESCAPE then    begin        //gText := '';        switchOffOUT.asInteger(1);        switchTextOUT.asString(gRevertText);        gSwitchedOff := TRUE;    end    //otherwise, add the key to buttonText and send it out.    else    begin          Debug('key ' + Chr(keynum));        gText := gText + Chr(keynum);        switchTextOUT.asString(gText);        gSwitchedOff := TRUE;    end;    //end;procedure Callback(n:integer);    begin    if n = switchIN then processSwitch(switchIN.asInteger)       else if (n =  keyNumIN) and (keyNumIN.asInteger > 0) and gLive then    begin       //we could store, and wait for zero (key up)       idebug('process key num',keyNumIN.asInteger);       processKey(keyNumIN.asInteger);    endend;// no process blocprocedure processIdle();begin    if gSwitchedOff then    begin        gSwitchedOff := FALSE;        switchOffOUT.asInteger(0);        textOUT.length(-1);        switchTextOUT.length(-1);    end;end;

Statistics: Posted by woodslanding — 09 Dec 2024, 07:39


]]>
2024-12-09T07:43:33+02:00 2024-12-09T07:43:33+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45607#p45607 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]> Statistics: Posted by woodslanding — 09 Dec 2024, 06:43


]]>
2024-12-09T03:48:48+02:00 2024-12-09T03:48:48+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45606#p45606 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
Also, Is there somewhere in the documentation where it is noted what actual version of pascal Usine uses? That would be nice information to know. I am always trying commands I find on the web, but they don't work in usine....

thanks!!!
-eric

Statistics: Posted by woodslanding — 09 Dec 2024, 02:48


]]>
2024-12-08T18:38:38+02:00 2024-12-08T18:38:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45603#p45603 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
Trying to figure this out...

Would sure be nice to have an 'is editing' output on the textfield....

Statistics: Posted by woodslanding — 08 Dec 2024, 17:38


]]>
2024-12-08T08:04:06+02:00 2024-12-08T08:04:06+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=45601#p45601 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
This patch makes me unreasonably happy. A text fader that triggers on enter, even if the text is unchanged. So great!

Mouse in makes sure enter key doesn't have an effect unless the text is open for editing...

cheers!

Statistics: Posted by woodslanding — 08 Dec 2024, 07:04


]]>
2022-11-25T11:18:45+02:00 2022-11-25T11:18:45+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44497#p44497 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
ss key.png

Statistics: Posted by senso — 25 Nov 2022, 10:18


]]>
2022-11-25T08:03:35+02:00 2022-11-25T08:03:35+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44496#p44496 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
enterKey2.png
But this still has the problem that I cannot change the value of text 2, even when 'pass' is off. The pass output shows [-1], but the value still won't change.

Statistics: Posted by woodslanding — 25 Nov 2022, 07:03


]]>
2022-11-25T07:52:42+02:00 2022-11-25T07:52:42+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44495#p44495 <![CDATA[Re: Any way to know when Enter key is pressed on text fader?]]>
enterKey.png
(for some reason, the 'key' output on the keyboard module is always zero.)

The problem here, which I never know how to solve, is that if I put a PIC module before the text 2 fader, then change the text 2 fader value, and want to update it back to the old text 1 value, the PIC module doesn't see a change, and nothing happens. If I don't add a PIC, then I can't change the value of text2 at all.

I encounter this kind of issue a lot, and I am trying to figure out a way around it.....

Statistics: Posted by woodslanding — 25 Nov 2022, 06:52


]]>
2022-11-25T07:33:38+02:00 2022-11-25T07:33:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=7071&p=44494#p44494 <![CDATA[Any way to know when Enter key is pressed on text fader?]]>
Thoughts?

Thanks!!!!

Statistics: Posted by woodslanding — 25 Nov 2022, 06:33


]]>