Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Sven Barth
Am 27.07.2015 11:37 schrieb "Mark Morgan Lloyd" < markmll.laza...@telemetry.co.uk>: > > Now obviously I could have a separate property holding an enumeration, but it's a pity that it's not possible to do something like > > case MainForm.OutputComponent of > TListBox: begin end; >

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Sven Barth
Am 27.07.2015 12:06 schrieb "Mark Morgan Lloyd" < markmll.laza...@telemetry.co.uk>: > > Péter Gábor wrote: >> >> If you use the classname property you can: >> >> case Sender.classname of >> 'TCheckBox': ShowMessage('This is a TCheckBox'); >> end; > > > Good point. I wonder if that's mode-specific

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Péter Gábor
2015-07-27 13:33 keltezéssel, Michael Schnell írta: > > I suppose you meant > > if Sender is TButton then { do something} ; > > -Michael > Yes! -- Péter Gábor p...@freemail.hu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http:/

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Flávio Etrusco
On Mon, Jul 27, 2015 at 6:37 AM, Mark Morgan Lloyd wrote: > JuuS wrote: >> >> On 07/27/2015 09:31 AM, Mark Morgan Lloyd wrote: >>> >>> Péter Gábor wrote: Sorry! I was "misreading" your mail... you want to know the type of them. You can compare the type of them: i

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Michael Schnell
On 07/27/2015 07:47 AM, Péter Gábor wrote: if Sender = TButton then { do something} ; I suppose you meant if Sender is TButton then { do something} ; OP: If you want to deal with a lot of different classes that might be the sender, it might help to define an array of these classes (types) an

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Chris Kelling
Sorry about that - that message was supposed to be sent in reply to a message rhar came in right before one that was for this list. My Note 4 thought I was trying to reply a thread in the Lazarus group. -Chris On Jul 27, 2015 7:23 AM, Chris Kelling wrote: > > We have one in Room B. It is Ed S

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Chris Kelling
We have one in Room B. It is Ed Sax's old machine. It is an early model that has the chicklett keyboard. About the only distinction tge PC Jr has is that is was a finacial failure. Both style of keyboards are wireless, but you had to have the keyboard aimed directly at the IR receiver on the PC.

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Mark Morgan Lloyd
Péter Gábor wrote: If you use the classname property you can: case Sender.classname of 'TCheckBox': ShowMessage('This is a TCheckBox'); end; Good point. I wonder if that's mode-specific (language manual simply says "Free Pascal allows"). -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Péter Gábor
If you use the classname property you can: case Sender.classname of 'TCheckBox': ShowMessage('This is a TCheckBox'); end; 2015-07-27 09:31 keltezéssel, Mark Morgan Lloyd írta: > Péter Gábor wrote: >> >> if Sender = TButton then { do something} ; > > Can this be elegantly put into a case statem

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Michael Van Canneyt
On Mon, 27 Jul 2015, Mark Morgan Lloyd wrote: JuuS wrote: On 07/27/2015 09:31 AM, Mark Morgan Lloyd wrote: Péter Gábor wrote: Sorry! I was "misreading" your mail... you want to know the type of them. You can compare the type of them: if Sender = TButton then { do something} ; Can this be

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Mark Morgan Lloyd
JuuS wrote: On 07/27/2015 09:31 AM, Mark Morgan Lloyd wrote: Péter Gábor wrote: Sorry! I was "misreading" your mail... you want to know the type of them. You can compare the type of them: if Sender = TButton then { do something} ; Can this be elegantly put into a case statement? Hi, I just

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread JuuS
On 07/27/2015 09:31 AM, Mark Morgan Lloyd wrote: > Péter Gábor wrote: >> Sorry! >> I was "misreading" your mail... you want to know the type of them. >> >> You can compare the type of them: >> >> if Sender = TButton then { do something} ; > > Can this be elegantly put into a case statement? > H

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-27 Thread Mark Morgan Lloyd
Péter Gábor wrote: Sorry! I was "misreading" your mail... you want to know the type of them. You can compare the type of them: if Sender = TButton then { do something} ; Can this be elegantly put into a case statement? -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-26 Thread Sven Barth
Am 27.07.2015 07:48 schrieb "Péter Gábor" : > > Sorry! > I was "misreading" your mail... you want to know the type of them. > > You can compare the type of them: > > if Sender = TButton then { do something} ; The correct operator is "is" not "=". Regards, Sven -- _

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-26 Thread Péter Gábor
Sorry! I was "misreading" your mail... you want to know the type of them. You can compare the type of them: if Sender = TButton then { do something} ; or you can get the name of the class ShowMessage( Sender.classname ); 2015-07-27 07:30 keltezéssel, Péter Gábor írta: > If you typecast someth

Re: [Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-26 Thread Péter Gábor
If you typecast something you can use the fields and properties of the type you use for casting, for example: if TCheckBox(Sender).Checked then {do_something} ; or if TCheckBox(Components[I]).Checked then {do_something} ; 2015-07-27 00:31 keltezéssel, Bob B. írta: > how to get Type of Sender

[Lazarus] how to get Type of Sender or Components[i] in order to Cast?

2015-07-26 Thread Bob B.
Thanks. Bob B. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus