Richard
10-05-2006, 06:46 AM
With my background in VB, these may or may not be bugs...
interesting though.
1. The DIV function
In VB this returns the integer part from a division, so
x$ = 76.5;
x$ = x$ DIV 10;
would have given 7.0 in VB.
The normal divide / returns the fraction part
x$ = 76.5;
x$ = x$ / 10;
would give 7.65
In PPL I get 7.65 from the DIV. Is this a feature of C++?
(If so, another reason why I never liked C++)
My work around was:
x$ = 76.5;
x$ = (x$ - (x$ MOD 10)) / 10;
2. One trick I used in VB was to store lists in an invisible
control as this allowed me to insert or delete items which
is not that easy in an array.
When I tried this in PPL my list was sorted, so no longer
matched the order that I wanted.
Note: LBS_Sort was NOT checked!
My work around was to put the item number as a sting
at the start of each line.
3. When I tried to fix 2, my first solution was like this,
With my item number in n$ and the text in t$
w$ = STR(n$); // Get item as string
w$ = Lpad(w$, "0", 2) // add leading zero
w$ = w$ % t$; // append text
z$ = ListBox_Add(lstParms$, w$); // put in list
However the LPAD returned an empty sring
so my code finished up like this:
w$ = STR(n$);
if (n$ < 10)
w$ = "0" % w$;
end;
w$ = w$ % t$;
z$ = ListBox_Add(lstParms$, w$);
That's it (so far).
interesting though.
1. The DIV function
In VB this returns the integer part from a division, so
x$ = 76.5;
x$ = x$ DIV 10;
would have given 7.0 in VB.
The normal divide / returns the fraction part
x$ = 76.5;
x$ = x$ / 10;
would give 7.65
In PPL I get 7.65 from the DIV. Is this a feature of C++?
(If so, another reason why I never liked C++)
My work around was:
x$ = 76.5;
x$ = (x$ - (x$ MOD 10)) / 10;
2. One trick I used in VB was to store lists in an invisible
control as this allowed me to insert or delete items which
is not that easy in an array.
When I tried this in PPL my list was sorted, so no longer
matched the order that I wanted.
Note: LBS_Sort was NOT checked!
My work around was to put the item number as a sting
at the start of each line.
3. When I tried to fix 2, my first solution was like this,
With my item number in n$ and the text in t$
w$ = STR(n$); // Get item as string
w$ = Lpad(w$, "0", 2) // add leading zero
w$ = w$ % t$; // append text
z$ = ListBox_Add(lstParms$, w$); // put in list
However the LPAD returned an empty sring
so my code finished up like this:
w$ = STR(n$);
if (n$ < 10)
w$ = "0" % w$;
end;
w$ = w$ % t$;
z$ = ListBox_Add(lstParms$, w$);
That's it (so far).