Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
Hello Sieghard.

> Why could that drive someone crazy, ?

Huh, I was talking about all the possibilities that enum gives and the
difficult task to choose the best one.
The "new illegal-nil-none item" in the enum can be placed everywhere but
imho at end will give shorter code and so less chance to introduce new bug.

This when code like this is used:

--> for ar1:= low(scrollbarareaty) to high(scrollbarareaty) do begin

// was changed with (due to 2 last added items):

---> for ar1:= low(scrollbarareaty) to sba_end do begin



And there is also the proposition of Roland that is great:

type
  TOption = (optNil = -1, optOne, optTwo, optThree);
  TValidOption = optOne..optThree;

var
  o: TOption;
 
begin
  o := optNil;
  for o := Low(TValidOption) to High(TValidOption) do 

_

You see, not easy to decide what code to choose.

Fre;D











--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread Sieghard
Hello fredvs,

you wrote on Thu, 12 Mar 2020 02:22:15 -0700 (MST):

> > BTW, I'd suggest to use the word "illegal"   
> 
> Ha, ok, in last commit I did use "none" or "nil", I will change it asap.

The name has no function, so I think it should be chosen on intended
function. If the member is used just to satisfy the syntax, "nil" or "none"
are alright. If it is used to signify a state outside the normal range or
even not normally allowable, "undefined" or even "illegal" seem appropriate
to me, because those names express the meaning "literally".

> > tabulatorkindty = (tak_illegal:= -1, tak_left, tak_right,
> > tak_centered,tak_decimal);   

From your examples of Martin's use, and the fact that he expressly used a
value outside the bounds of the enumeration, I derived the impression that,
indeed, this special value was meant to signify some illegal state. That's
why I suggested "_illegal" here.

> Like explained to Roland, in last commits I did place "tak_illegal" as
> last member of the enum.

Commonly, the placement of the members has no significance as long as
they're not used for enumeration, as in a "for" or "while" statement, where
a variable of the type is in- or decremented through some defined range.
If that is done, you have to be aware of the specific _sequence_ of the
members, and that's where their placement will be of importance.

> Take this original example:
> 
> scrollbarareaty =
> (sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none)
> ...
> const
>  scrollbarclicked = ord(sba_end) + 1;
> 
> You may see that Martin did add a "extended" value for scrollbarareaty:
> scrollbarclicked.

Not exactly - he defined an _integer_ constant having the value given by
the _position_ of "tba_end" in its enumeration, plus one.

> This is not "catholic" so I did add 2 members in the enum:
> sba_clicked,sba_none and adapt the code for it:
> 
> scrollbarareaty =
> (sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none);
> 
> In that case the order is important, because at a moment, this is called
> in original code:
> 
> bu1:= low(scrollbarareaty) to high(scrollbarareaty)

Yes, that's exactly the case where it is important, the enumeration is
scanned sequentially, enumerated, that is.

> So it was changed with: 
> 
> bu1:= low(scrollbarareaty) to high(scrollbarareaty)-2

You mean, it was changed _from_ this expression?
Yes, your way is the more elegant one, and regarding the constant
definition, it may well be what was really intended, but because of some
condition not immediately done cleanly.

you wrote on Thu, 12 Mar 2020 03:08:01 -0700 (MST):

...
> Of course the order of enum has no influence on bu1:= low(scrollbarareaty)
> to high(scrollbarareaty).

Not on the bounds, but on the sequence of members within, which _is_ "the
order of enum".

> But, (trust me), it was more easy if "sba_none" was placed at end than at
> begin of enum.

And it was quite correct for this purpose.

...
> Of course "sba_none" placed at begin works also, but more code is needed
> for this.

Sure, that way, you change the main property of the enumeration, its
_order_.

> But if you really prefer "sba_none" placed at first place, I will change
> it with pleasure (asap).

No, as that's not a matter of "preference" here, but a matter of _use_.
And that's clearly demonstrated by what you wrote later:

you wrote on Thu, 12 Mar 2020 10:29:20 -0700 (MST):

> > scrollbarclicked = ord(sba_end) + 1; // not a "good boy" code.   

Right.

> Imho, it is not a  "good boy" code because later there is:
> 
> ---> if kind = scrollbarareaty(scrollbarclicked) then // this gives a  
> warning with fpc 3.2.0, not fpc 3.0.4.

Yes, this triggered the "out of bounds" warning for enumeration values that
seems to have been added to the later version of fpc.

> OK, I stop before to become (stay) completely crazy.

Why could that drive someone crazy, if he thought somewhat about the
purpose and construction of enumerations? You probabely won't get crazy,
e.g., if someone tells you he wants to get to the third seat in a theater
seat row that's number from 124 to 188 - you probabely can tell him
immediately he should take seat number 126, don't you?

-- 
-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---




___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] Space and empty lines removed in commits.

2020-03-12 Thread fredvs
> I suggest,if you want, apply it to ALL the source code in the repo and make
one
> commit that says trimming the whitespace. Done and dusted! ;-) 

Ho, yes, it would be wonderful.

But...

Mse has **many** units, doing this via a editor will takes ages...

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] Space and empty lines removed in commits.

2020-03-12 Thread Graeme Geldenhuys
On 12/03/2020 5:39 pm, fredvs wrote:
> Yes, my fault, now I see that it was absolutely not a good idea.

Martin once told me too, to revert my contributions because I enabled
"trim trailing whitespace".  :-)

The MSEide+MSEgui code is full of such trailing whitespace. I suggest,
if you want, apply it to ALL the source code in the repo and make one
commit that says trimming the whitespace. Done and dusted! ;-)

After that, all will be good. No point in having contributions
"polluted" by such whitespace noise.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
> if not fixed. 

Yes, as written in a previous mail, I let, for the sport, 2 Warnings to fix.

This is the first, the second is not bad too.

;-)

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] Space and empty lines removed in commits.

2020-03-12 Thread fredvs
Hello Graeme.

> change a editor setting (eg: trim trailing whitespace)? 

Yes, my fault, now I see that it was absolutely not a good idea.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
> scrollbarclicked = ord(sba_end) + 1; // not a "good boy" code. 

Imho, it is not a  "good boy" code because later there is:

---> if kind = scrollbarareaty(scrollbarclicked) then // this gives a
warning with fpc 3.2.0, not fpc 3.0.4.

OK, I stop before to become (stay) completely crazy.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] Space and empty lines removed in commits.

2020-03-12 Thread Graeme Geldenhuys
On 12/03/2020 10:26 am, fredvs wrote:
> Maybe Graeme could refresh my mind?

Use the 'git diff' with the following parameters

-b   (ignores changes in amount of whitespace)
-w   (ignores all whitespace)


But I would be thinging to myself, why did Git complain about those in
the first place. Did you run a code formatter over the code? Did you
change a editor setting (eg: trim trailing whitespace)?


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
>Sorry I dont find now the code that demonstrate that it was easier if
> "sba_none" was placed at end. 

OK, I found it.

This was a original code (see scrollbarclicked new added constant):

type
 scrollbarareaty = (sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end);

const
 scrollbarclicked = ord(sba_end) + 1; // not a "good boy" code.

I did change code adding 2 new items in scrollbarareaty (scrollbarclicked
=sba_clicked) and sba_none: 
And remove const scrollbarclicked (that becomes sba_clicked in the enum
array).

---> scrollbarareaty =
(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none);

// sba_none was placed at end because, later in code:

---> for ar1:= low(scrollbarareaty) to high(scrollbarareaty) do begin

// was changed with (due to 2 last added items):

---> for ar1:= low(scrollbarareaty) to sba_end do begin

Of course you could add sba_none in first position and do:

---> for ar1:= sbbu_down to sba_end do begin

So, I wait for the vote for the code you want.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread Roland Chastain
Hello everybody!

We could also make something like this:

type
  TOption = (optNil = -1, optOne, optTwo, optThree);
  TValidOption = optOne..optThree;

var
  o: TOption;
  
begin
  o := optNil;
  for o := Low(TValidOption) to High(TValidOption) do
;
end.

Regards.

Roland



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


[MSEide-MSEgui-talk] Space and empty lines removed in commits.

2020-03-12 Thread fredvs
Hello.

When I check my last commits, doing a "diff", shows also all the spaces end
empty lines removed.

That makes the read of the change much more complicated, I would prefer that
only the change in code was show.

I know that there is a option in Git to ignore the change done for space and
empty lines.
Sadly, I do not remember what was that git command.

Maybe Graeme could refresh my mind?

Thanks.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
Sorry to monopolize.

But re-re ooops.

In previous mail, when I did try to explain why I opted to place the new
"sba_none" at end, I did choose a wrong example.

Of course the order of enum has no influence on bu1:= low(scrollbarareaty)
to high(scrollbarareaty).

But, (trust me), it was more easy if "sba_none" was placed at end than at
begin of enum.

Sorry I dont find now the code that demonstrate that it was easier if
"sba_none" was placed at end.

Of course "sba_none" placed at begin works also, but more code is needed for
this.

But if you really prefer "sba_none" placed at first place, I will change it
with pleasure (asap).

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
Re-ooops.

In previous mail:

>Take this original example:
>scrollbarareaty =
>(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none)

Please read (forget sba_clicked,sba_none):

Take this original example:
scrollbarareaty =
(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end)

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
Oops, in previous mail:

>Take this original example:
>scrollbarareaty =
>(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none) 

Please read (forget sba_none):

Take this original example:
scrollbarareaty =
(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked) 

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] About Warnings with mseide + fpc 3.0.4 / 3.2.0

2020-03-12 Thread fredvs
Hello Sieghard

**Many thanks** for all that clear explanation.

> BTW, I'd suggest to use the word "illegal" 

Ha, ok, in last commit I did use "none" or "nil", I will change it asap.

> tabulatorkindty = (tak_illegal:= -1, tak_left, tak_right,
> tak_centered,tak_decimal); 

Like explained to Roland, in last commits I did place "tak_illegal" as last
member of the enum.

Take this original example:

scrollbarareaty =
(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none)
...
const
 scrollbarclicked = ord(sba_end) + 1;

You may see that Martin did add a "extended" value for scrollbarareaty:
scrollbarclicked.

This is not "catholic" so I did add 2 members in the enum:
sba_clicked,sba_none and adapt the code for it:

scrollbarareaty =
(sbbu_down,sbbu_move,sbbu_up,sba_start,sba_end,sba_clicked,sba_none);

In that case the order is important, because at a moment, this is called in
original code:

bu1:= low(scrollbarareaty) to high(scrollbarareaty)

So it was changed with: 

bu1:= low(scrollbarareaty) to high(scrollbarareaty)-2

Fre;D








--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk