You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The below code example creates a FlowBox with random children in it, when a child gets activated, all similar children will be selected (I.e, if double-clicked or hit space on child 'a', all children with label 'a' get selected)
the issue is it is not consistent, it works sometimes but if continue activating children it throws the error.
use GTK::Raw::Types;
use GTK::Compat::Types;
use GTK::Application;
use GTK::FlowBox;
use GTK::Label;
use GTK::Button;
use GTK::Box;
my $app = GTK::Application.new(
title => 'org.genex.test.widget',
width => 400,
height => 400
);
$app.activate.tap({
CATCH { default { .message.say; $app.exit } }
my GTK::Button $exit .= new_with_label: <exit>;
$exit.clicked.tap: { $app.exit };
my $str = qq:to/END/;
{ ('a' .. 'z').pick( * ).join }
{ ('a' .. 'z').pick( * ).join }
{ ('a' .. 'z').pick( * ).join }
{ ('a' .. 'z').pick( * ).join }
{ ('a' .. 'z').pick( * ).join }
END
my $flowbox = GTK::FlowBox.new;
$flowbox.halign = GTK_ALIGN_START;
$flowbox.valign = GTK_ALIGN_START;
$flowbox.homogeneous = True;
$flowbox.selection-mode = GTK_SELECTION_MULTIPLE;
$flowbox.min_children_per_line = 26;
$flowbox.max_children_per_line = 26;
$flowbox.activate-on-single-click = False;
$flowbox.child-activated.tap( -> ( $f, $c, $p, $r ) {
my $sym = $f.get-selected-children.head.get-child.label;
my @child = $f.get-children.grep({ .get-child.label ~~ $sym });
@child.map( -> $child { $f.select-child: $child } );
} );
for $str.words.join.comb -> $sym {
my $child = GTK::FlowBoxChild.new;
#$child.add-events: GDK_BUTTON_PRESS_MASK;
$child.add: GTK::Label.new: $sym;
$flowbox.add: $child;
}
my $box = GTK::Box.new-vbox();
$box.pack_start($flowbox, False, False, 0);
$box.pack_start($exit, False, False, 0);
$app.window.add: $box;
$app.show_all;
});
$app.run;
### ERROR:
Cannot call method from outside of a GTK:: object (Any::IterateOneWithoutPhasers.push-all)
in method IS-PROTECTED at /home/hythm/dev/GTK/p6-GtkPlus/lib/GTK/Roles/Protection.pm6 (GTK::Roles::Protection) line 66
in block at tmp/sym.p6 line 43
in block at /home/hythm/dev/GTK/p6-GtkPlus/lib/GTK/Roles/Signals/FlowBox.pm6 (GTK::Roles::Signals::FlowBox) line 29
in block at /home/hythm/.rakudobrew/versions/moar-blead/install/share/perl6/core/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 583
in method run at /home/hythm/dev/GTK/p6-GtkPlus/lib/GTK/Application.pm6 (GTK::Application) line 219
in block <unit> at tmp/sym.p6 line 68
I though not to report this since FlowBox.pm6 might not be ready yet,(because I needed to make changes to it to make this example work, "diff below", However the reason I reported it is because I think it's related to #40
Changes to FlowBox.pm6:
8 use GTK::Roles::Orientable;
9 +use GTK::Roles::Signals::FlowBox;
16 also does GTK::Roles::Orientable;
17 + also does GTK::Roles::Signals::FlowBox;
34 - my $to-be-selected = self!resolve-selected-child;
35 + my $to-be-selected = self!resolve-selected-child($child);
43 - my $to-be-unselected = self!resolve-selected-child;
44 + my $to-be-unselected = self!resolve-selected-child($child);
The text was updated successfully, but these errors were encountered:
The below code example creates a FlowBox with random children in it, when a child gets activated, all similar children will be selected (I.e, if double-clicked or hit space on child 'a', all children with label 'a' get selected)
the issue is it is not consistent, it works sometimes but if continue activating children it throws the error.
I though not to report this since FlowBox.pm6 might not be ready yet,(because I needed to make changes to it to make this example work, "diff below", However the reason I reported it is because I think it's related to #40
Changes to FlowBox.pm6:
The text was updated successfully, but these errors were encountered: