Re: Call method if declared only

2020-03-01 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote: How to implement ? I would go for a template mixin that implements send operation in each subclass. Sine template mixin's content is declared in scope of declaration not template's module, the code inside it is aware of concr

Re: Call method if declared only

2020-02-29 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 12:21:41 UTC, Simen Kjærås wrote: On Friday, 28 February 2020 at 10:33:11 UTC, Виталий Фадеев wrote: Thanks all ! I happy ! Check this one: void On( T, M )( T o, M message ) { [snip] void main() { auto a = new A(); a.Send( a, WM_KE

Re: Call method if declared only

2020-02-28 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 28 February 2020 at 10:33:11 UTC, Виталий Фадеев wrote: Thanks all ! I happy ! Check this one: void On( T, M )( T o, M message ) { [snip] void main() { auto a = new A(); a.Send( a, WM_KEYUP ); a.Send( a, WM_KEYDOWN ); } That does mostly w

Re: Call method if declared only

2020-02-28 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 10:20:03 UTC, Виталий Фадеев wrote: On Friday, 28 February 2020 at 10:14:41 UTC, Виталий Фадеев wrote: On Friday, 28 February 2020 at 09:49:53 UTC, Simen Kjærås wrote: On Friday, 28 February 2020 at 09:25:58 UTC, Виталий Фадеев wrote: [...] So let's create a te

Re: Call method if declared only

2020-02-28 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 10:14:41 UTC, Виталий Фадеев wrote: On Friday, 28 February 2020 at 09:49:53 UTC, Simen Kjærås wrote: On Friday, 28 February 2020 at 09:25:58 UTC, Виталий Фадеев wrote: [...] So let's create a template for that: [...] Cool! Think! I writing code generation.

Re: Call method if declared only

2020-02-28 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 09:49:53 UTC, Simen Kjærås wrote: On Friday, 28 February 2020 at 09:25:58 UTC, Виталий Фадеев wrote: [...] So let's create a template for that: [...] Cool!

Re: Call method if declared only

2020-02-28 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 28 February 2020 at 09:25:58 UTC, Виталий Фадеев wrote: Yes. Thank ! I read it. Problem is - OS has many messages + user messages... It mean what interfaces like IKeyDown must me declared. All. Dream on write less code... So let's create a template for that: interface IMessageHand

Re: Call method if declared only

2020-02-28 Thread drug via Digitalmars-d-learn
On 2/28/20 12:25 PM, Виталий Фадеев wrote: Now I reading Template doc for up skill... I recommend this nice tutorial https://github.com/PhilippeSigaud/D-templates-tutorial

Re: Call method if declared only

2020-02-28 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 09:12:38 UTC, Simen Kjærås wrote: On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote: Searching solution for idea ! For whatever reason, it seems my attempts at answering this earlier has disappeared into the void. Here: import core.sys.windows.

Re: Call method if declared only

2020-02-28 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote: Searching solution for idea ! For whatever reason, it seems my attempts at answering this earlier has disappeared into the void. Here: import core.sys.windows.windows; import std.stdio; class Base { LRESULT On(UINT messa

Re: Call method if declared only

2020-02-28 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 08:36:53 UTC, mipri wrote: On Friday, 28 February 2020 at 08:08:59 UTC, Виталий Фадеев wrote: [...] The pattern throughout Phobos is static tests, like isInputRange!R [...] It cool ! I will try ! Thank you !

Re: Call method if declared only

2020-02-28 Thread mipri via Digitalmars-d-learn
On Friday, 28 February 2020 at 08:08:59 UTC, Виталий Фадеев wrote: Searching for beauty readable code... The pattern throughout Phobos is static tests, like isInputRange!R So something like this: import std.stdio; import std.traits; template canOnKey(T) { static if (__traits(hasM

Re: Call method if declared only

2020-02-28 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 28 February 2020 at 08:08:59 UTC, Виталий Фадеев wrote: On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote: Searching solution for idea ! Goal is to get System message, dispatch/route to method ! If method implemented only ! I dream on in future write clean code of a

Re: Call method if declared only

2020-02-28 Thread Виталий Фадеев via Digitalmars-d-learn
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote: Searching solution for idea ! Goal is to get System message, dispatch/route to method ! If method implemented only ! I dream on in future write clean code of a derived widgets like this : class Base { // dispat

Call method if declared only

2020-02-27 Thread Виталий Фадеев via Digitalmars-d-learn
Searching solution for idea ! Goal is to get System message, dispatch/route to method ! If method implemented only ! I dream on in future write clean code of a derived widgets like this : class Base { // dispatch void On( message ... ) { // call On()