ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2015-04-13T09:43:23+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/3952 2015-04-13T09:43:23+02:00 2015-04-13T09:43:23+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=32225#p32225 <![CDATA[need help with string !]]>
I know this is from relatively back-in-the-day but I just ran into the same compiler fail. Y'all probably will kick yourselves.

AinsiCharPtr
^
AnsiCharPtr

6.2 is superb.
hi Blaakk,

Yep, i made some refactoring with this version.
It's mentioned in the 'Release notes' which should be consulted carefully for each version release.
We try to avoid refactoring as it can prevent existing code to compile, but in some case, we have to.

The gold rule is to always read the 'Release notes' for new distrib version.

I'm really happy that you like the 6.2 :D

Statistics: Posted by martignasse — 13 Apr 2015, 09:43


]]>
2015-04-05T02:58:42+02:00 2015-04-05T02:58:42+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=32036#p32036 <![CDATA[need help with string !]]>
AinsiCharPtr
^
AnsiCharPtr

6.2 is superb.

Statistics: Posted by Blaakk — 05 Apr 2015, 02:58


]]>
2013-07-12T01:53:59+02:00 2013-07-12T01:53:59+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27177#p27177 <![CDATA[need help with string !]]>
weird, this wasn't working :

CODE:

if &#40;&#40;Message->wParam == 1&#41; && &#40;Message->lParam == MSG_CHANGE&#41; && &#40;Message->result == 1&#41;&#41; //received 1 on "enable" input    &#123;
but this is working fine

CODE:

if &#40;&#40;Message->wParam == 1&#41; && &#40;Message->lParam == MSG_CHANGE&#41;&#41;         &#123;  if &#40;sdkGetEvtData&#40;m_enable&#41; == 1&#41;&#123;
so now I have the proper user module to write text from a MINITEL to Usine, next to do is the module to send comma text to the MINITEL

And in between I have to better understand C++ syntax, hope "le site du zero" will suffice.

Statistics: Posted by oli_lab — 12 Jul 2013, 01:53


]]>
2013-07-11T20:54:59+02:00 2013-07-11T20:54:59+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27173#p27173 <![CDATA[need help with string !]]>

CODE:

         m_textNew = sdkGetEvtPChar&#40;m_textInput&#41;; //        str.push_back&#40;&#40;char&#41; m_textNew&#41;;        sdkSetEvtPChar&#40;m_textOutput, &#40;AinsiCharPtr&#41; &#40;str.c_str&#40;&#41;&#41;&#41;;        //sdkSetEvtPChar&#40;m_textOutput, m_textNew&#41;;
m_textNew is a char pointer, and you add it to str as a char, that's the problem

replace

CODE:

 str.push_back&#40;&#40;char&#41; m_textNew&#41;;
by

CODE:

str.append&#40;m_textNew&#41;;
and it should work

Statistics: Posted by martignasse — 11 Jul 2013, 20:54


]]>
2013-07-11T17:42:02+02:00 2013-07-11T17:42:02+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27170#p27170 <![CDATA[need help with string !]]>
is "declare the string variable as a module member." means here :
protected:
// protected members goes here ?

...

CODE:

                m_textNew = sdkGetEvtPChar&#40;m_textInput&#41;; //str.push_back&#40;&#40;char&#41; m_textNew&#41;;sdkSetEvtPChar&#40;m_textOutput, &#40;AinsiCharPtr&#41; &#40;str.c_str&#40;&#41;&#41;&#41;;//sdkSetEvtPChar&#40;m_textOutput, m_textNew&#41;;
there's something wrong with the cast as if I set 77 on the input I get 'P' on the output.

Statistics: Posted by oli_lab — 11 Jul 2013, 17:42


]]>
2013-07-11T14:32:18+02:00 2013-07-11T14:32:18+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27166#p27166 <![CDATA[need help with string !]]>
welcome in C/C++ world ;)
...and thank you! :)

Of course, a pointer - I didn't think of that. That's why you go to all the trouble with vector arrays and all in the matrix modules.

Statistics: Posted by bsork — 11 Jul 2013, 14:32


]]>
2013-07-11T12:34:24+02:00 2013-07-11T12:34:24+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27155#p27155 <![CDATA[need help with string !]]>
However, it seems a bit strange as long as I build the string locally and immediately assign the value to the Caption member. One would think that the value is stored in Caption together with all the other data, and that the (temporary) string variable no longer is of interest.
but the variable stored in Caption is a pointer, who is just the address to the string content
so the string have to be alive until this pointer is used by usine to access the string content and copy it

welcome in C/C++ world ;)

Statistics: Posted by martignasse — 11 Jul 2013, 12:34


]]>
2013-07-11T12:13:02+02:00 2013-07-11T12:13:02+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27154#p27154 <![CDATA[need help with string !]]>
Well, anyway, I'll try with a global variable tonight.

Statistics: Posted by bsork — 11 Jul 2013, 12:13


]]>
2013-07-11T11:29:23+02:00 2013-07-11T11:29:23+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27153#p27153 <![CDATA[need help with string !]]>
I'm trying to make a user module that will put a new appearing character at the end of a existing string
I too have a similar problem, but I was trying to use a std::string variable as a parameter caption. I tried different approaches, and ended up with casting similar to examples in the SDK:

(AinsiCharPtr) (s.c_str())

This compiled without warnings, and the string also looked OK when traced, but the parameter caption was empty.
using std::string and casting it like that is the way to go.

but be sure to declare this std::string variable at module level (in the include file, as a member of the module), you can modify it's content at any time, but declaring it as a member variable of the module ensure the variable is alive when usine try to copy it's content.

if you declare it in the onGetParamInfos() or onCallback() function, it's just a locale variable without enough lifetime and is already destroyed when usine try to copy it's content.

to resume :
declare the string variable as a module member.
construct or modify the string content when you want before using it

Statistics: Posted by martignasse — 11 Jul 2013, 11:29


]]>
2013-07-11T08:31:50+02:00 2013-07-11T08:31:50+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27148#p27148 <![CDATA[need help with string !]]>
(AinsiCharPtr) (s.c_str())

This compiled without warnings, and the string also looked OK when traced, but the parameter caption was empty.

Statistics: Posted by bsork — 11 Jul 2013, 08:31


]]>
2013-07-10T23:31:28+02:00 2013-07-10T23:31:28+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27143#p27143 <![CDATA[need help with string !]]> I'm trying to make a user module that will put a new appearing character at the end of a existing string
this is for my project of born again Minitel (sooo french).

I already made a script that works fine, and was quite straight forward to make :

CODE:

//////////////////////////// retourneur de string/////////////////////////// parameters declarationVar input, dummy, reset   &#58; TParameter;Var output    &#58; TParameter;var sl1       &#58; UNICODESTRING;var sl2       &#58; UNICODESTRING;var size      &#58; integer;// destroyprocedure Destroy;begin   sl1.free; sl2.free;end;// initialisation &#58; create parametersprocedure init;begin   SetModuleColor&#40;$800080+302999&#41;; input &#58;= createParam&#40;'in',ptTextField&#41;; SetIsOutPut&#40;input,false&#41;; reset&#58;=  CreateParam&#40;'reset',PtButton&#41;;   SetIsOutput&#40;reset,false&#41;; output  &#58;= createParam&#40;'out',ptTextField&#41;; SetIsInPut&#40;output,false&#41;; size  &#58;= createParam&#40;'size',ptDataField&#41;; SetIsInPut&#40;size,false&#41;;end;// Global variables//////////////////////////////// CallBack proc//////////////////////////////Procedure CallBack&#40;n&#58;integer&#41;;beginif &#40;n = reset&#41; then begin IF &#40;reset >= 1&#41; THEN  sl2 &#58;= getStringValue&#40;input&#41;;end;if &#40;n = input&#41; then begin sl1 &#58;= getStringValue&#40;input&#41;; sl2 &#58;= sl2 + sl1 end; SetStringValue&#40;output,sl2&#41;; SetValue&#40;size,Length&#40;sl2&#41;&#41;;end;
Now I'm stuck with the user module : the sdkSetEvtPChar(m_textOutput, (AinsiCharPtr) str); is the problem as every thing compile fine without it

CODE:

void StringFlip&#58;&#58;onCallBack&#40;UsineMessage *Message&#41; &#123;if &#40;&#40;Message->wParam == 1&#41; && &#40;Message->lParam == MSG_CHANGE&#41; && &#40;Message->result == 1&#41;&#41; //received 1 on "enable" input&#123;    m_textNew = sdkGetEvtPChar&#40;m_textInput&#41;; //std&#58;&#58;string str;str.push_back&#40;&#40;char&#41;m_textNew&#41;;sdkSetEvtPChar&#40;m_textOutput, &#40;AinsiCharPtr&#41; str&#41;; // this is not working, no conversion between std&#58;&#58;string and AinsiCharPtr&#125;if &#40;&#40;Message->wParam == 2&#41; && &#40;Message->lParam == MSG_CHANGE&#41; && &#40;Message->result == 1&#41;&#41; //received 1 on "reset" input&#123;sdkSetEvtPChar&#40;m_textOutput, ""&#41;;&#125;&#125;
I did some research on the old 5.8 archive and find this :
http://www.sensomusic.com/wiki/doku.php?id=sdk:code:snippets:event_parameters:

but I don't understand "what" is pPrototype->PTextTest->len; I need to declare it but how ?

well I'm stuck !

thanx for your help.

Statistics: Posted by oli_lab — 10 Jul 2013, 23:31


]]>
BrainModular BrainModular Users Forum 2015-04-13T09:43:23+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/3952 2015-04-13T09:43:23+02:00 2015-04-13T09:43:23+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=32225#p32225 <![CDATA[need help with string !]]>
I know this is from relatively back-in-the-day but I just ran into the same compiler fail. Y'all probably will kick yourselves.

AinsiCharPtr
^
AnsiCharPtr

6.2 is superb.
hi Blaakk,

Yep, i made some refactoring with this version.
It's mentioned in the 'Release notes' which should be consulted carefully for each version release.
We try to avoid refactoring as it can prevent existing code to compile, but in some case, we have to.

The gold rule is to always read the 'Release notes' for new distrib version.

I'm really happy that you like the 6.2 :D

Statistics: Posted by martignasse — 13 Apr 2015, 09:43


]]>
2015-04-05T02:58:42+02:00 2015-04-05T02:58:42+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=32036#p32036 <![CDATA[need help with string !]]>
AinsiCharPtr
^
AnsiCharPtr

6.2 is superb.

Statistics: Posted by Blaakk — 05 Apr 2015, 02:58


]]>
2013-07-12T01:53:59+02:00 2013-07-12T01:53:59+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27177#p27177 <![CDATA[need help with string !]]>
weird, this wasn't working :

CODE:

if &#40;&#40;Message->wParam == 1&#41; && &#40;Message->lParam == MSG_CHANGE&#41; && &#40;Message->result == 1&#41;&#41; //received 1 on "enable" input    &#123;
but this is working fine

CODE:

if &#40;&#40;Message->wParam == 1&#41; && &#40;Message->lParam == MSG_CHANGE&#41;&#41;         &#123;  if &#40;sdkGetEvtData&#40;m_enable&#41; == 1&#41;&#123;
so now I have the proper user module to write text from a MINITEL to Usine, next to do is the module to send comma text to the MINITEL

And in between I have to better understand C++ syntax, hope "le site du zero" will suffice.

Statistics: Posted by oli_lab — 12 Jul 2013, 01:53


]]>
2013-07-11T20:54:59+02:00 2013-07-11T20:54:59+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27173#p27173 <![CDATA[need help with string !]]>

CODE:

         m_textNew = sdkGetEvtPChar&#40;m_textInput&#41;; //        str.push_back&#40;&#40;char&#41; m_textNew&#41;;        sdkSetEvtPChar&#40;m_textOutput, &#40;AinsiCharPtr&#41; &#40;str.c_str&#40;&#41;&#41;&#41;;        //sdkSetEvtPChar&#40;m_textOutput, m_textNew&#41;;
m_textNew is a char pointer, and you add it to str as a char, that's the problem

replace

CODE:

 str.push_back&#40;&#40;char&#41; m_textNew&#41;;
by

CODE:

str.append&#40;m_textNew&#41;;
and it should work

Statistics: Posted by martignasse — 11 Jul 2013, 20:54


]]>
2013-07-11T17:42:02+02:00 2013-07-11T17:42:02+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27170#p27170 <![CDATA[need help with string !]]>
is "declare the string variable as a module member." means here :
protected:
// protected members goes here ?

...

CODE:

                m_textNew = sdkGetEvtPChar&#40;m_textInput&#41;; //str.push_back&#40;&#40;char&#41; m_textNew&#41;;sdkSetEvtPChar&#40;m_textOutput, &#40;AinsiCharPtr&#41; &#40;str.c_str&#40;&#41;&#41;&#41;;//sdkSetEvtPChar&#40;m_textOutput, m_textNew&#41;;
there's something wrong with the cast as if I set 77 on the input I get 'P' on the output.

Statistics: Posted by oli_lab — 11 Jul 2013, 17:42


]]>
2013-07-11T14:32:18+02:00 2013-07-11T14:32:18+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27166#p27166 <![CDATA[need help with string !]]>
welcome in C/C++ world ;)
...and thank you! :)

Of course, a pointer - I didn't think of that. That's why you go to all the trouble with vector arrays and all in the matrix modules.

Statistics: Posted by bsork — 11 Jul 2013, 14:32


]]>
2013-07-11T12:34:24+02:00 2013-07-11T12:34:24+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27155#p27155 <![CDATA[need help with string !]]>
However, it seems a bit strange as long as I build the string locally and immediately assign the value to the Caption member. One would think that the value is stored in Caption together with all the other data, and that the (temporary) string variable no longer is of interest.
but the variable stored in Caption is a pointer, who is just the address to the string content
so the string have to be alive until this pointer is used by usine to access the string content and copy it

welcome in C/C++ world ;)

Statistics: Posted by martignasse — 11 Jul 2013, 12:34


]]>
2013-07-11T12:13:02+02:00 2013-07-11T12:13:02+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27154#p27154 <![CDATA[need help with string !]]>
Well, anyway, I'll try with a global variable tonight.

Statistics: Posted by bsork — 11 Jul 2013, 12:13


]]>
2013-07-11T11:29:23+02:00 2013-07-11T11:29:23+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27153#p27153 <![CDATA[need help with string !]]>
I'm trying to make a user module that will put a new appearing character at the end of a existing string
I too have a similar problem, but I was trying to use a std::string variable as a parameter caption. I tried different approaches, and ended up with casting similar to examples in the SDK:

(AinsiCharPtr) (s.c_str())

This compiled without warnings, and the string also looked OK when traced, but the parameter caption was empty.
using std::string and casting it like that is the way to go.

but be sure to declare this std::string variable at module level (in the include file, as a member of the module), you can modify it's content at any time, but declaring it as a member variable of the module ensure the variable is alive when usine try to copy it's content.

if you declare it in the onGetParamInfos() or onCallback() function, it's just a locale variable without enough lifetime and is already destroyed when usine try to copy it's content.

to resume :
declare the string variable as a module member.
construct or modify the string content when you want before using it

Statistics: Posted by martignasse — 11 Jul 2013, 11:29


]]>
2013-07-11T08:31:50+02:00 2013-07-11T08:31:50+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27148#p27148 <![CDATA[need help with string !]]>
(AinsiCharPtr) (s.c_str())

This compiled without warnings, and the string also looked OK when traced, but the parameter caption was empty.

Statistics: Posted by bsork — 11 Jul 2013, 08:31


]]>
2013-07-10T23:31:28+02:00 2013-07-10T23:31:28+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=3952&p=27143#p27143 <![CDATA[need help with string !]]> I'm trying to make a user module that will put a new appearing character at the end of a existing string
this is for my project of born again Minitel (sooo french).

I already made a script that works fine, and was quite straight forward to make :

CODE:

//////////////////////////// retourneur de string/////////////////////////// parameters declarationVar input, dummy, reset   &#58; TParameter;Var output    &#58; TParameter;var sl1       &#58; UNICODESTRING;var sl2       &#58; UNICODESTRING;var size      &#58; integer;// destroyprocedure Destroy;begin   sl1.free; sl2.free;end;// initialisation &#58; create parametersprocedure init;begin   SetModuleColor&#40;$800080+302999&#41;; input &#58;= createParam&#40;'in',ptTextField&#41;; SetIsOutPut&#40;input,false&#41;; reset&#58;=  CreateParam&#40;'reset',PtButton&#41;;   SetIsOutput&#40;reset,false&#41;; output  &#58;= createParam&#40;'out',ptTextField&#41;; SetIsInPut&#40;output,false&#41;; size  &#58;= createParam&#40;'size',ptDataField&#41;; SetIsInPut&#40;size,false&#41;;end;// Global variables//////////////////////////////// CallBack proc//////////////////////////////Procedure CallBack&#40;n&#58;integer&#41;;beginif &#40;n = reset&#41; then begin IF &#40;reset >= 1&#41; THEN  sl2 &#58;= getStringValue&#40;input&#41;;end;if &#40;n = input&#41; then begin sl1 &#58;= getStringValue&#40;input&#41;; sl2 &#58;= sl2 + sl1 end; SetStringValue&#40;output,sl2&#41;; SetValue&#40;size,Length&#40;sl2&#41;&#41;;end;
Now I'm stuck with the user module : the sdkSetEvtPChar(m_textOutput, (AinsiCharPtr) str); is the problem as every thing compile fine without it

CODE:

void StringFlip&#58;&#58;onCallBack&#40;UsineMessage *Message&#41; &#123;if &#40;&#40;Message->wParam == 1&#41; && &#40;Message->lParam == MSG_CHANGE&#41; && &#40;Message->result == 1&#41;&#41; //received 1 on "enable" input&#123;    m_textNew = sdkGetEvtPChar&#40;m_textInput&#41;; //std&#58;&#58;string str;str.push_back&#40;&#40;char&#41;m_textNew&#41;;sdkSetEvtPChar&#40;m_textOutput, &#40;AinsiCharPtr&#41; str&#41;; // this is not working, no conversion between std&#58;&#58;string and AinsiCharPtr&#125;if &#40;&#40;Message->wParam == 2&#41; && &#40;Message->lParam == MSG_CHANGE&#41; && &#40;Message->result == 1&#41;&#41; //received 1 on "reset" input&#123;sdkSetEvtPChar&#40;m_textOutput, ""&#41;;&#125;&#125;
I did some research on the old 5.8 archive and find this :
http://www.sensomusic.com/wiki/doku.php?id=sdk:code:snippets:event_parameters:

but I don't understand "what" is pPrototype->PTextTest->len; I need to declare it but how ?

well I'm stuck !

thanx for your help.

Statistics: Posted by oli_lab — 10 Jul 2013, 23:31


]]>