Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlowBox.get-child-at-pos not working as expected #43

Open
hythm7 opened this issue Nov 11, 2019 · 0 comments
Open

FlowBox.get-child-at-pos not working as expected #43

hythm7 opened this issue Nov 11, 2019 · 0 comments

Comments

@hythm7
Copy link
Collaborator

hythm7 commented Nov 11, 2019

Getting this error when running the below code:

No such method 'label' for invocant of type 'GTK::Raw::Types::GtkWidget'
  in block <unit> at /tmp/flowbox-at-pos.p6 line 46

get-child-at-index returns GTK::FlowBoxChild.new
get-child-at-pos returns GTK::Raw::Types::GtkFlowBoxChild.new

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 $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 = 4;
  $flowbox.max_children_per_line = 4;

  for 'a' .. 'z' -> $sym {
    my $child = GTK::FlowBoxChild.new;
    $child.add: GTK::Label.new: $sym;
    $flowbox.add: $child;
  }

  #say $flowbox.get-child-at-index( 9 ).get-child.label;

  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;

  say $flowbox.get-child-at-index( 0 ).get-child.label;  # works
  say $flowbox.get-child-at-pos( 0, 0 ).get-child.label; # throws error

});

$app.run;

Edit: remove incorrect statement.

Xliff added a commit that referenced this issue Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant