Coder Social home page Coder Social logo

Comments (6)

Scimon avatar Scimon commented on August 28, 2024 1

Ok. Using GTK::Simple:ver<0.1.10> (from zef). I ran the following code :

#!/usr/bin/env perl6

use v6;
use GTK::Simple;
use GTK::Simple::App;

my $app = GTK::Simple::App.new(title=> 'Test');
my $text = GTK::Simple::TextView.new(text=>'Original');
my $button = GTK::Simple::ToggleButton.new(label=>'Update');

$button.clicked.tap( { $text.text = "New" } );

$app.set-content(
    GTK::Simple::VBox.new( 
	$text,
	$button,
    )
);
$app.border-width = 20;
$app.run;

The App opens but the Text box is empty and when I click the update I get the following :

Cannot modify an immutable Str ()
  in block <unit> at src/perl6/desktop-apps/text-test.p6 line 11

Perl6 version 2018.11 built on MoarVM version 2018.11

from gtk-simple.

Xliff avatar Xliff commented on August 28, 2024 1

This is due to the fact that the accessor method:

method text() {
    Proxy.new:
        FETCH => {
            gtk_text_buffer_get_text($!buffer, self!start-iter(),
                self!end-iter(), 1)
        },
        STORE => -> \c, \text {
            gtk_text_buffer_set_text($!buffer, text.Str, -1);
        }
}

Is not "is rw". I think this code worked up until a recent commit of Perl6, where the bug that allowed this to work without the 'rw' trait was fixed.

from gtk-simple.

jonathanstowe avatar jonathanstowe commented on August 28, 2024

I think you're going to have to talk us through this as I can't get the as-is examples/17-scrolled-window-with-textview.p6 to do anything untoward.

from gtk-simple.

Scimon avatar Scimon commented on August 28, 2024

Sorry, was mostly working through my Advent calender article at the time (suprise guess what it's about?).
I'll investigate further.

from gtk-simple.

jonathanstowe avatar jonathanstowe commented on August 28, 2024

Yeah that's entirely what it is.

Let me have a quick look at that.

from gtk-simple.

jonathanstowe avatar jonathanstowe commented on August 28, 2024

As it stands the constructor for the TextView doesn't do anything with a text argument. Arguably it should but that should probably be handled separately as it will require a bit of a rework of the whole class.

from gtk-simple.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.