is it reasonable to require parts of HTDP in “normal” programs ??
shrink-tl
seems like what i want so i can “force” loaded bitmaps to a known size
(define dwane (make-object bitmap% (string->path "/Users/chrismatheson/Downloads/dwayne1.jpg")))
(new message%
[parent image]
[label dwane]
[min-height 100]
[min-width 100]
[stretchable-width false]
[stretchable-height false])
however this end up with the “full size” image, but i wanted it locked to a max of 100x100
i thought by setting the stretchability to false it would do that
@chris613 I’m just going to check the docs but I would have thought if you make the image non-stretchable it won’t ‘shrink to fit’. Just a guess, I’ll check the docs.
yeah i suspected that might be the case, which i was looking into shrink-tl
but the original was how i hoped things would work :wink:
also (this one might be a little simpler)
i get that there is a callback defined aspart of the window intereface for dropped files https://docs.racket-lang.org/gui/window___.html?q=message%25#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._window~3c~25~3e%29._on-drop-file%29%29
but i dont understand how to actually set that callback to my own function when defining a panel%
Hmm.. After a quick look, I’m not much clearer. I would say it would be better to scale the image to the correct size first.
yeah, i think thats what ill have a go at next :slightly_smiling_face:
this isnt a criticism, more of an observation …. quite a lot of the GUI components feel a bit batteries-not-included type thing. I assume the rationale is to ship primitives and let the ecosystem take care of the rest. Am i missing a nice library of batteries included GUI components
MrLib provides more but may still be more basic than you want. I think the GUI toolkit is just that, a toolkit for building GUI components (but I could easily be wrong). I think it is sort of required that you extend the base components and customise as necessary. This I think is true when you want to do specific event handling.
coolio. any poiinters on the file drop callback thing ?
Sorry, not really my field. I don’t do a lot of GUI work, so my opinions are probably not too reliable.
not at all, any and all help is very welcome :slightly_smiling_face:
@chris613 It’s easy to overlook: https://docs.racket-lang.org/framework/index.html
Although I think for the panel%
situation you would have to subclass the panel%
object and override the on-drop-file.
ahhh
Cool
can i (set-field! on-drop-file (lambda () …))
?
off to try :wink: