Re: [fpc-pascal] Sets & FPC

2018-05-29 Thread martin_wynne
Justin Smyth wrote > how do I do something like this > > if odSelected in state then > begin > // My Code > end; > > I get this error - Error: Incompatible types: got "TOwnerDrawStateType" > expected " > > " Hi Justin, I'm sure you have fixed this by now, but for anyone else, the answer

Re: [fpc-pascal] Sets as array index?

2013-10-14 Thread Sven Barth
Am 15.10.2013 07:11 schrieb "Jürgen Hestermann" : > > Am 2013-10-12 14:07, schrieb Jürgen Hestermann: > > > I want to do something like this (which is not directly possible but maybe by some other way?): > > > > I := TagArray[TagSet]; > > I := TagArray[[tag1,tag5]]; > > or > > I := TagArray[ord(Tag

Re: [fpc-pascal] Sets as array index?

2013-10-14 Thread Jürgen Hestermann
Am 2013-10-12 14:07, schrieb Jürgen Hestermann: > I want to do something like this (which is not directly possible but maybe by some other way?): > > I := TagArray[TagSet]; > I := TagArray[[tag1,tag5]]; > or > I := TagArray[ord(TagSet)]; > I := TagArray[ord([tag1,tag5])]; > > I think that the com

[fpc-pascal] Sets as array index?

2013-10-14 Thread Jürgen Hestermann
I have a declaration like this: type TagType = (tag1,tag2,tag3,tag4,tag5); TagSetType = set of TagType; I now want to store numbers for each of the 2^n possible set settings [tag1,tag2,tag3,tag4,tag5] [tag1,tag2,tag3,tag4 ] [tag1,tag2,tag3 ,tag5] .. and so on... so

Re: [fpc-pascal] Sets

2013-10-02 Thread Juha Manninen
On Thu, Oct 3, 2013 at 1:58 AM, Jonas Maebe wrote: > It is part of {$mode delphi}: > http://wiki.freepascal.org/User_Changes_2.6.0#Sizes_of_sets_in_TP.2FDelphi_mode Ok, sorry Marco and Jonas. This unit did not have Mode Delphi. I thought the setting in a Lazarus project was enough but no. This un

Re: [fpc-pascal] Sets

2013-10-02 Thread Jonas Maebe
On 02 Oct 2013, at 23:01, Juha Manninen wrote: > On Wed, Oct 2, 2013 at 10:50 PM, Sven Barth > wrote: >> And as Peter already mentioned there is $PACKSET: >> http://freepascal.org/docs-html/prog/progsu61.html#x67-660001.1.61 > > Ok, {$PACKSET 1} helps. > I expected it to be part of {$Mode Delp

Re: [fpc-pascal] Sets

2013-10-02 Thread Juha Manninen
On Wed, Oct 2, 2013 at 10:50 PM, Sven Barth wrote: > And as Peter already mentioned there is $PACKSET: > http://freepascal.org/docs-html/prog/progsu61.html#x67-660001.1.61 Ok, {$PACKSET 1} helps. I expected it to be part of {$Mode Delphi}. Most things are Delphi compatible with it. Thanks. Juha

Re: [fpc-pascal] Sets

2013-10-02 Thread Marco van de Voort
In our previous episode, Juha Manninen said: [ Charset ISO-8859-1 unsupported, converting... ] > If I have have a set with < 9 elements, like : > > type > TMyEnum = ( > xOne, > xTwo, > xThree, > xFour, > xFive > ); > // Count <= 8, fits in one Byte > TMyEnums = set of T

Re: [fpc-pascal] Sets

2013-10-02 Thread Sven Barth
On 02.10.2013 19:09, Juha Manninen wrote: If I have have a set with < 9 elements, like : type TMyEnum = ( xOne, xTwo, xThree, xFour, xFive ); // Count <= 8, fits in one Byte TMyEnums = set of TMyEnum; then in Delphi a variable of that type can be casted to B

Re: [fpc-pascal] Sets

2013-10-02 Thread Peter
Perhaps you need the {$PACKENUM n} compiler directive for the enumerated type? On 02/10/13 18:09, Juha Manninen wrote: > If I have have a set with < 9 elements, like : > > type > TMyEnum = ( > xOne, > xTwo, > xThree, > xFour, > xFive > ); > // Count <= 8, fits in one Byt

[fpc-pascal] Sets

2013-10-02 Thread Juha Manninen
If I have have a set with < 9 elements, like : type TMyEnum = ( xOne, xTwo, xThree, xFour, xFive ); // Count <= 8, fits in one Byte TMyEnums = set of TMyEnum; then in Delphi a variable of that type can be casted to Byte. Other casts don't work. In FPC I must cast it to

Re: [fpc-pascal] Sets & FPC

2010-02-21 Thread Jonas Maebe
On 21 Feb 2010, at 13:20, Justin Smyth wrote: > The orginal code comes from JVCL , which wont complile under FPC , the actual > unit is jvlistbox.pas Without full source code that compiles rather than uncompilable snippets it takes a lot more time to help you. Please post the full source code

Re: [fpc-pascal] Sets & FPC

2010-02-21 Thread Justin Smyth
riginal Message - From: "Jonas Maebe" To: "Justin Smyth" ; "FPC-Pascal users discussions" Sent: Sunday, February 21, 2010 8:11 PM Subject: Re: [fpc-pascal] Sets & FPC On 21 Feb 2010, at 07:26, Justin Smyth wrote: I've done the bit Micheal suggest n

Re: [fpc-pascal] Sets & FPC

2010-02-21 Thread Jonas Maebe
On 21 Feb 2010, at 07:26, Justin Smyth wrote: > I've done the bit Micheal suggest now which i highlight TWMDrawItem it says > its comes from TLMDrawItems. > > i still get Error: Incompatible types: got "TOwnerDrawStateType" expected > "" Can you post the full program somewhere? (or the full s

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Justin Smyth
; Cc: "Justin Smyth" Sent: Saturday, February 20, 2010 11:43 PM Subject: Re: [fpc-pascal] Sets & FPC On Sat, 20 Feb 2010, Jonas Maebe wrote: On 20 Feb 2010, at 13:15, Michael Van Canneyt wrote: On Sat, 20 Feb 2010, Justin Smyth wrote: procedure TJvCustomListBox.CNDrawIt

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Michael Van Canneyt
On Sat, 20 Feb 2010, Jonas Maebe wrote: On 20 Feb 2010, at 13:15, Michael Van Canneyt wrote: On Sat, 20 Feb 2010, Justin Smyth wrote: procedure TJvCustomListBox.CNDrawItem(var Msg: TWMDrawItem); var State: TOwnerDrawState; Try State : Set of TOwnerDrawState; It is already a set: lc

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Jonas Maebe
On 20 Feb 2010, at 13:15, Michael Van Canneyt wrote: > On Sat, 20 Feb 2010, Justin Smyth wrote: > >> procedure TJvCustomListBox.CNDrawItem(var Msg: TWMDrawItem); >> var >> State: TOwnerDrawState; > > Try > > State : Set of TOwnerDrawState; It is already a set: lcltype.pp: TOwnerDrawState =

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Michael Van Canneyt
On Sat, 20 Feb 2010, Justin Smyth wrote: procedure TJvCustomListBox.CNDrawItem(var Msg: TWMDrawItem); var State: TOwnerDrawState; Try State : Set of TOwnerDrawState; Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://li

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Justin Smyth
lRect(rcItem); if odFocused in State then DrawFocusRect(hDC, rcItem); end; end; Canvas.Handle := 0; end; end; - Original Message - From: "Jonas Maebe" To: "Justin Smyth" ; "FPC-Pascal users discussions" Sent: Saturday, February 20, 20

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Jonas Maebe
On 20 Feb 2010, at 12:32, Justin Smyth wrote: > Opps re reading the code it was actually > > if (odSelected in State) then > > and state is defined as TOwnerDrawState which points back to > -TBaseOwnerDrawState which is a set of TOwnerDrawStateType Please post sample code that should compile

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread Justin Smyth
Kind Regards Justin Smyth - Original Message - From: "cobines" To: "Justin Smyth" ; "FPC-Pascal users discussions" Sent: Saturday, February 20, 2010 9:07 PM Subject: Re: [fpc-pascal] Sets & FPC If state is of type TOwnerDrawStateType then it c

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread cobines
If state is of type TOwnerDrawStateType then it can have only one value: var state: TOwnerDrawStateType; ... if odSelected = state then begin // My Code end; If state is a set type of TOwnerDrawStateType then it can have more values: var state: set of TOwnerDrawStateType; ... if odSelec

[fpc-pascal] Sets & FPC

2010-02-20 Thread Justin Smyth
I've got a piece of code which uses TOwnerDrawStateType and TBaseOwnerDrawState which is set of TOwnerDrawStateType , if i have on variable called state which is TOwnerDrawStateType how do i do something like this if odSelected in state then begin // My Code end; i get this error - Error