On Thursday, 29 June 2017 at 14:30:19 UTC, Andrea Fontana wrote:
On Thursday, 29 June 2017 at 13:01:10 UTC, ct wrote:
I was only able to do it this way:
auto on_next_previous = &this.OnNextPreviousMatch;
entry_.addOnNextMatch(&partial!(on_next_previous, true));
entry_.addOnPreviousMatch(&partial!(on_next_previous,
false));
I think you should provide a better example in order to get
some help.
We neither know what argument .addOnNextMatch() expects.
Usually a full example on https://dpaste.dzfl.pl or other
websites is more useful :)
Andrea
Sorry. Please check this DPaste:
https://dpaste.dzfl.pl/6379944510b8
addOnNextMatch() is gtk.SearchEntry.addOnNextMatch()
[https://api.gtkd.org/gtkd/gtk/SearchEntry.html] which has the
signature:
gulong addOnNextMatch (void delegate(SearchEntry) dlg,
ConnectFlags connectFlags = cast(ConnectFlags)0);
So basically, it needs a
void delegate(SearchEntry)
as an argument.
I wanted to create a single callback member function to handle
both addOnNextMatch() and addOnPreviousMatch() by binding a bool
value (true for next_match, false for previous_match) so that the
callback knows which case it is handling.
It compiled when I wrote:
auto on_next_previous = &this.OnNextPreviousMatch;
entry_.addOnNextMatch(&partial!(on_next_previous, true));
entry_.addOnPreviousMatch(&partial!(on_next_previous, false));
But not when I wrote:
entry_.addOnNextMatch(partial!(&this.OnNextPreviousMatch, true));
Or
entry_.addOnNextMatch(partial!(&Editor.OnNextPreviousMatch,
true));
Error: value of 'this' is not known at compile time