ArrayArrayArray BrainModular BrainModular Users Forum 2009-12-30T02:04:33+02:00 https://brainmodular.org/forums/app.php/feed/topic/1840 2009-12-30T02:04:33+02:00 2009-12-30T02:04:33+02:00 https://brainmodular.org/forums/viewtopic.php?t=1840&p=11121#p11121 <![CDATA[[script] ptTextField type]]>
great, this works perfectly !

and yes, you can avoid looping:

CODE:

var str_tmp &#58; String;begin     str_tmp &#58;= GetStringValue&#40;filein&#41;;end;
but after a few hours of trying Pascal, it seems to me that you *have* to loop for about (nearly) everything :P

thanks again !

_yvan (obliged to write code by/for manecante)

Statistics: Posted by manecante — 30 Dec 2009, 01:04


]]>
2009-12-30T01:19:53+02:00 2009-12-30T01:19:53+02:00 https://brainmodular.org/forums/viewtopic.php?t=1840&p=11117#p11117 <![CDATA[[script] ptTextField type]]>

CODE:

...VAR filename   &#58; String;...PROCEDURE init;BEGIN    ...  pFilename &#58;= CreateParam&#40;'file name', ptTextField&#41;; SetIsOutput&#40;pFilename, FALSE&#41;;  ...END; // initPROCEDURE GetFileName;  VAR i &#58; integer;  VAR c &#58; String;  VAR s &#58; String;BEGIN  s &#58;= '';  filename &#58;= GetStringValue&#40;pFileName&#41;;  FOR i &#58;= 1 TO &#40;length&#40;filename&#41;&#41; DO BEGIN    c &#58;= copy&#40;filename, i, 1&#41;;    IF &#40;c <> '"'&#41; THEN      s &#58;= s + c;  END;  filename &#58;= s;  writeln&#40;'FileName&#58; ' + filename&#41;;END; // GetFileName...
Hope this helps.

Actually, I'm not 100% sure that you have to create a loop and copy the string one character at the time, but at least it works :)

Statistics: Posted by bsork — 30 Dec 2009, 00:19


]]>
2009-12-30T00:37:23+02:00 2009-12-30T00:37:23+02:00 https://brainmodular.org/forums/viewtopic.php?t=1840&p=11113#p11113 <![CDATA[[script] ptTextField type]]>
Pascal n00b question:
I cannot seem to find the correct type for ptTextField:

CODE:

...filein &#58;= createParam&#40;'filename', ptTextField&#41;;...
I was expecting to get a String with GetValue(filein) but I get a "type mismatch" error...
it seems that I get 1 single, which is an ASCII value of the 1st letter of the typed in text.

am I wrong assuming that it should be a String (or an array of ascii chars) ???

if yes, how can I get the value of the string entered in the textfield ?

cheers

Statistics: Posted by manecante — 29 Dec 2009, 23:37


]]>
BrainModular BrainModular Users Forum 2009-12-30T02:04:33+02:00 https://brainmodular.org/forums/app.php/feed/topic/1840 2009-12-30T02:04:33+02:00 2009-12-30T02:04:33+02:00 https://brainmodular.org/forums/viewtopic.php?t=1840&p=11121#p11121 <![CDATA[[script] ptTextField type]]>
great, this works perfectly !

and yes, you can avoid looping:

CODE:

var str_tmp &#58; String;begin     str_tmp &#58;= GetStringValue&#40;filein&#41;;end;
but after a few hours of trying Pascal, it seems to me that you *have* to loop for about (nearly) everything :P

thanks again !

_yvan (obliged to write code by/for manecante)

Statistics: Posted by manecante — 30 Dec 2009, 01:04


]]>
2009-12-30T01:19:53+02:00 2009-12-30T01:19:53+02:00 https://brainmodular.org/forums/viewtopic.php?t=1840&p=11117#p11117 <![CDATA[[script] ptTextField type]]>

CODE:

...VAR filename   &#58; String;...PROCEDURE init;BEGIN    ...  pFilename &#58;= CreateParam&#40;'file name', ptTextField&#41;; SetIsOutput&#40;pFilename, FALSE&#41;;  ...END; // initPROCEDURE GetFileName;  VAR i &#58; integer;  VAR c &#58; String;  VAR s &#58; String;BEGIN  s &#58;= '';  filename &#58;= GetStringValue&#40;pFileName&#41;;  FOR i &#58;= 1 TO &#40;length&#40;filename&#41;&#41; DO BEGIN    c &#58;= copy&#40;filename, i, 1&#41;;    IF &#40;c <> '"'&#41; THEN      s &#58;= s + c;  END;  filename &#58;= s;  writeln&#40;'FileName&#58; ' + filename&#41;;END; // GetFileName...
Hope this helps.

Actually, I'm not 100% sure that you have to create a loop and copy the string one character at the time, but at least it works :)

Statistics: Posted by bsork — 30 Dec 2009, 00:19


]]>
2009-12-30T00:37:23+02:00 2009-12-30T00:37:23+02:00 https://brainmodular.org/forums/viewtopic.php?t=1840&p=11113#p11113 <![CDATA[[script] ptTextField type]]>
Pascal n00b question:
I cannot seem to find the correct type for ptTextField:

CODE:

...filein &#58;= createParam&#40;'filename', ptTextField&#41;;...
I was expecting to get a String with GetValue(filein) but I get a "type mismatch" error...
it seems that I get 1 single, which is an ASCII value of the 1st letter of the typed in text.

am I wrong assuming that it should be a String (or an array of ascii chars) ???

if yes, how can I get the value of the string entered in the textfield ?

cheers

Statistics: Posted by manecante — 29 Dec 2009, 23:37


]]>