Post Reply 
[Programming] Treat like an adress, not like a number
12-02-2017, 01:46 PM
Post: #5
RE: [Programming] Treat like an adress, not like a number
(12-02-2017 07:58 AM)Arno K Wrote:  I hope that using [] instead of {} for indices using lists will help you.
Nope :/
When you make an input, you give it "lists", like this:

Code:
INPUT(
{
{condTot,[0],{42,20,0}}, {flechaSN,0,{90,10,0}},
{xComum,[0],{20,20,1}}, {yComum,[0],{70,20,1}},
{rComum,[0],{20,20,2}}, {tipComum,{"MACICO","FILAMENTADO","GEMINADO","BESSEL"},{70,25,2}}
},
"Informações gerais",
{
"Qtde de condutores:","Flecha",
"X Comum", "Y Comum",
"R Comum", "Tipo Comum"
},
{
"Quantos condutores no total?","Tem flecha?",
"Posição da maioria", "Altura da maioria",
"Raio da maioria", "Tipo da maioria"
}
);

This will give me a form like this:
[Image: 1UbnYvp.png]

But at the end of this, you will see that is not exactly lists Sad

So guys, before I move on, I did some changes on my program, now I'm using the EXPR() function, like grsbanks suggested Smile
First I make a list, in a form of a string, and when I give it to the INPUT function, I give it using the EXPR function, like this:

Code:

formVar:="{";
FOR TEMP0 FROM 1 TO condTot DO
TEMP1:=2+TEMP0;
IF TEMP0==condTot THEN
//This is to just to know if it is the lant item, if so, it will not have a comma
formVar:=formVar+"{L9("+TEMP1+",1),[0],{20,20,"+TEMP0+"}}, {L9("+TEMP1+",2),[0],{70,20,"+TEMP0+"}}}";
ELSE
formVar:=formVar+"{L9("+TEMP1+",1),[0],{20,20,"+TEMP0+"}}, {L9("+TEMP1+",2),[0],{70,20,"+TEMP0+"}},";
END;
formTit:=append(formTit,"X Cond "+TEMP0+":", "Y Cond "+TEMP0+":");
END;
//formVar will be a string and formTit a list
//Now the input:
INPUT(
{
EXPR(formVar) //To take the string and give it like a list
},
"TEST",
{
formTit
}
);

And, in an ideal world, the program would understand like this:
Code:

/I got this after printing, copying and pasting the exact output from formVar and formTit, and give them to a separated INPUT().
INPUT(
{{L9(3,1),[0],{20,20,1}}, {L9(3,2),[0],{70,20,1}},{L9(4,1),[0],{20,20,2}}, {L9(4,2),[0],{70,20,2}},{L9(5,1),[0],{20,20,3}}, {L9(5,2),[0],{70,20,3}},{L9(6,1),[0],{20,20,4}}, {L9(6,2),[0],{70,20,4}},{L9(7,1),[0],{20,20,5}}, {L9(7,2),[0],{70,20,5}}}
,"TEST",
{"X Cond 1:", "Y Cond 1:", "X Cond 2:", "Y Cond 2:", "X Cond 3:", "Y Cond 3:", "X Cond 4:", "Y Cond 4:", "X Cond 5:", "Y Cond 5:"});

And my INPUT would look like this:
[Image: exORI8W.png]

But, of course, the world is not that simple so, I got "Error: Invalid input".

(12-02-2017 09:21 AM)Didier Lachieze Wrote:  Do you expect to get all couples of input values on the same input screen?
So, that's what I want, if the user enters 3, it will 6 questions on the next INPUT, for entering 4, 8 inputs in the INPUT screen, and so on Wink

grsbanks, L9 is global, formVar and formTit are local.

After that, I had to dig a little further, and I did this, I gave something that I know that it will work, I extracted the list of inputs, and gave it back, but now in a list.

Code:

test:={ //the input list
{condTot,[0],{42,20,0}}, {flechaSN,0,{90,10,0}},
{xComum,[0],{20,20,1}}, {yComum,[0],{70,20,1}},
{rComum,[0],{20,20,2}}, {tipComum,tipos,{70,25,2}}
};
INPUT(
test, //the list
"Informações gerais"
);

And I got "Error: Invalid input", so, the thing we give to the INPUT function that looks like a list, is not exactly a list :/

Thank you guys again for the help
The rest of the code
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [Programming] Treat like an adress, not like a number - alexandrehos - 12-02-2017 01:46 PM



User(s) browsing this thread: 1 Guest(s)