I am struggling to find any help in the GUI framework docs, but how does frame event handling work. For example, how do I catch a frame resize event, assuming one occurs?
Hmmm… I think I’ve found it. Looks like you need to sub-class the frame or canvas and override the event handlers. Seems like overkill, is there any other way?
Objects (instances) react to an en event according to the class. In order to change the reaction (event handler) you need to define a new class (aka sub-class) and override the event handler. In short: you are doing it as intended.
@mark.warren ^
@soegaard2 Thanks, just wondered if there was any way to set callbacks like you can on buttons etc. But if not that is cool. Cheers
Unless there are callback in the constructor, you have to sub-class.
I see that now. Thanks again.
Of course, you could write a subclass that takes a callback in its constructor.
I could indeed.
Hi, what’s the most popular lib or package to build gui program?
or should I just use racket/gui
?
@markx yes, that’s what you should use
there are some libraries that build on top of that, such as framework
@samth so how is framework
comparing to racket/gui
? Also htdp/gui
?
framework
is a set of additional libraries — you still use racket/gui
you should not use htdp/gui
@samth OK thanks!
Is there an example of using racket/gui
to build something like a chatting app?
And what is the difference between a text-field
and a editor-canvas
?
@markx a text-field is for plain-text entry, an editor canvas is something sufficient for implementing a full text or gui editor
for example, DrRacket uses an editor%
(with lots of other stuff) for the text editing
@samth well, according to the docs, text-field
also has an editor%
. > The text field is implemented using a text% editor (with an inaccessible display).
@markx that’s an implementation detail, and not particularly relevant
That’s where I don’t understand. If they both have an editor, then what makes a text-field just for plain-text entry, and not “sufficient for implementing a full text or gui editor” ?
because the editor is an implementation detail of the editor, and you can’t make it do the complicated things you want to do
hmm. I don’t get it. “the editor is an implementation detail of the editor” ?
you can think as two controls: basic-editor and advanced-editor
one is just for simple text entry but does not support formatting etc, the other has additional features but because of this it can be harder to use in your program
@andreiformiga Thanks. I see