mark.warren
2018-8-31 08:21:22

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?


mark.warren
2018-8-31 08:30:17

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?


soegaard2
2018-8-31 08:57:27

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.


soegaard2
2018-8-31 08:57:37

@mark.warren ^


mark.warren
2018-8-31 09:07:14

@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


soegaard2
2018-8-31 09:07:59

Unless there are callback in the constructor, you have to sub-class.


mark.warren
2018-8-31 09:08:50

I see that now. Thanks again.


philip.mcgrath
2018-8-31 14:35:25

Of course, you could write a subclass that takes a callback in its constructor.


mark.warren
2018-8-31 14:37:56

I could indeed.


markx
2018-8-31 18:11:53

Hi, what’s the most popular lib or package to build gui program?


markx
2018-8-31 18:12:06

or should I just use racket/gui?


samth
2018-8-31 18:46:05

@markx yes, that’s what you should use


samth
2018-8-31 18:46:16

there are some libraries that build on top of that, such as framework


markx
2018-8-31 18:46:52

@samth so how is framework comparing to racket/gui? Also htdp/gui?


samth
2018-8-31 18:47:41

framework is a set of additional libraries — you still use racket/gui


samth
2018-8-31 18:47:48

you should not use htdp/gui


markx
2018-8-31 18:59:23

@samth OK thanks!


markx
2018-8-31 18:59:49

Is there an example of using racket/gui to build something like a chatting app?


markx
2018-8-31 19:12:28

And what is the difference between a text-field and a editor-canvas?


samth
2018-8-31 19:25:30

@markx a text-field is for plain-text entry, an editor canvas is something sufficient for implementing a full text or gui editor


samth
2018-8-31 19:25:56

for example, DrRacket uses an editor% (with lots of other stuff) for the text editing


markx
2018-8-31 19:28:28

@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).


samth
2018-8-31 19:29:44

@markx that’s an implementation detail, and not particularly relevant


markx
2018-8-31 19:31:45

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” ?


samth
2018-8-31 19:36:05

because the editor is an implementation detail of the editor, and you can’t make it do the complicated things you want to do


markx
2018-8-31 19:37:20

hmm. I don’t get it. “the editor is an implementation detail of the editor” ?


andreiformiga
2018-8-31 19:38:37

you can think as two controls: basic-editor and advanced-editor


andreiformiga
2018-8-31 19:39:16

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


markx
2018-8-31 22:13:00

@andreiformiga Thanks. I see