Coder Social home page Coder Social logo

Comments (3)

nomad-software avatar nomad-software commented on May 31, 2024

@taylorh140 Have you got a sample program that highlights the issue?

from tkd.

taylorh140 avatar taylorh140 commented on May 31, 2024
module main;

import std.ascii;
import std.array;
import std.stdio;
import std.xml:Element,ElementParser,Tag,Document,DocumentParser;
import std.string;
import std.conv;
import std.typecons;
import std.uni;

import tkd.tkdapplication;                               // Import Tkd.

alias TextBox = tkd.widget.Text;
alias isAlpha = std.uni.isAlpha;

TextBox xmlTextBox;
TextBox registerTextBox;
TextBox bitFieldsTextBox;
TextBox mutabilityTextBox;
TextBox dTextBox;

class Application : TkdApplication                       // Extend TkdApplication.
{

    public void regmodifyText(CommandArgs args)
    {
        try{
            xmlTextBox.appendText("Good");
        }catch(Throwable s){
            xmlTextBox.appendText("Bad");
        }
    }

    override protected void initInterface()              // Initialise user interface.
    {
        auto panedwindow = new PanedWindow(Orientation.horizontal).pack(10, 0, GeometrySide.bottom, GeometryFill.both, AnchorPosition.northWest, true);
        auto FirstF  = new Frame(panedwindow,4, ReliefStyle.groove);
        auto SecondF = new Frame(panedwindow,4, ReliefStyle.groove);
        auto ThirdF  = new Frame(panedwindow,4, ReliefStyle.groove);

        auto FourthF       = new Frame(FirstF,4, ReliefStyle.groove).pack(10, 0, GeometrySide.top, GeometryFill.both, AnchorPosition.northWest, true);
            auto reglabel      = new Label(FourthF,"register").pack(10);
            registerTextBox    = new Text (FourthF).setHeight(0).bind("<<Modified>>", &this.regmodifyText ).pack(10, 0, GeometrySide.bottom, GeometryFill.both, AnchorPosition.northWest, true);
        auto FifthF        = new Frame(FirstF,4, ReliefStyle.groove).pack(10, 0, GeometrySide.top, GeometryFill.both, AnchorPosition.northWest, true);
            auto blabel        = new Label(FifthF,"Bit Fields").pack(10);
            bitFieldsTextBox   = new Text (FifthF).setHeight(0).pack(10, 0, GeometrySide.bottom, GeometryFill.both, AnchorPosition.northWest, true);
        auto SixthF        = new Frame(FirstF,4, ReliefStyle.groove).pack(10, 0, GeometrySide.top, GeometryFill.both, AnchorPosition.northWest, true);
            auto mlabel        = new Label(SixthF,"Mutability").pack(10);
            mutabilityTextBox  = new Text (SixthF).setHeight(0).pack(10, 0, GeometrySide.bottom, GeometryFill.both, AnchorPosition.northWest, true);
        auto xmllabel      = new Label(SecondF,"xml").pack(10);
        xmlTextBox         = new Text (SecondF).bind("<<Modified>>", &this.regmodifyText ).pack(10, 0, GeometrySide.left, GeometryFill.both, AnchorPosition.northWest, true);
        auto dlabel        = new Label(ThirdF,"D Registers").pack(10);
        dTextBox           = new Text (ThirdF).pack(10, 0, GeometrySide.left, GeometryFill.both, AnchorPosition.northWest, true);

         panedwindow
        .addPane(FirstF)
        .addPane(SecondF)
        .addPane(ThirdF);


    }
}



void main ()
{


    auto app = new Application();                        // Create the application.
    app.run();                                           // Run the application.


}

from tkd.

nomad-software avatar nomad-software commented on May 31, 2024

I was assuming this was like an onChange event for the text element, and it works that way for the first input change. But for subsequent changes no event occurs. Is there a flag that needs to be reset?

The <<Modified>> virtual event flags that particular widget as being modified. So in this case, when you type in your widgets, they have indeed been modified. This is normal behaviour. There are Tcl/Tk commands that enable you to read this flag later.

For your particular use case try using the <KeyRelease> event instead.

from tkd.

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.