dumb question about gadgets

Daniel Kochmański daniel at turtleware.eu
Sun Nov 12 20:13:27 UTC 2017


The behavior seems to be there for a long time and is not a bug but 
deliberately coded. This is made for consistency with all macros which 
support :move-cursor key parameter (like `surrounding-output-with-border'):

    If the boolean /move-cursor/ is true (the default), then the text
    cursor will be moved so that it immediately follows the lower right
    corner of the bordered output.

So if wrapping things in `vertically' solves the issue we are all set.

Best regards,
Daniel

On 11.11.2017 22:40, John Morrison wrote:
> Hey, thanks.  I will get on the task of trying to find out exactly 
> which commit changed the behavior I remember. This will, however, take 
> me a bit to wrap my brain around checking out particular git commit 
> versions, as I am pretty much a git lightweight.
>
> Thanks again!
>
> -jm
>
>
> On Sat, Nov 11, 2017 at 4:06 PM, Daniel Kochmański 
> <daniel at turtleware.eu <mailto:daniel at turtleware.eu>> wrote:
>
>     Alright. Fact that we start by diagonal lines looks like a bug
>     (though I'm not 100% sure) – could you please fill out the bug
>     report? If you know commit when it worked as you expected, that
>     would be helpful too.
>
>     As of your problem at hand – macro vertically (and all the others)
>     isn't limited only to layouts section, you may use it in
>     display-gadget function too. If you need something, what will
>     compose list in such macro, it is a matter of writing macro doing
>     just that, like
>
>     (defmacro vertically* (options body-list) `(vertically ,options
>     , at body-list))
>
>     -- cut here --
>
>     (in-package :clim-user)
>
>     (define-application-frame test-gadgets ()
>       ()
>       (:panes
>        (output
>         :application
>         :display-time :command-loop
>         :display-function 'display-gadgets)
>        (outputs
>         :application
>         :display-time :command-loop
>         :display-function 'display-gadgets2))
>       (:layouts
>        (default (horizontally ()  output outputs))))
>
>     (defmethod display-gadgets ((frame test-gadgets) stream)
>       (dolist (item '("one" "two" "three" "four"))
>         (with-output-as-gadget (stream)
>           (make-pane 'push-button
>                      :label item
>                      :activate-callback
>                      (lambda (&rest args)
>                        (declare (ignore args))
>                        (notify-user *application-frame* "You clicked a
>     button"))))))
>
>     (defun make-gadget (item)
>       (make-pane 'push-button
>                  :label item
>                  :activate-callback
>                  (lambda (&rest args)
>                    (declare (ignore args))
>                    (notify-user *application-frame* "You clicked a
>     button"))))
>
>     (defmethod display-gadgets2 ((frame test-gadgets) stream)
>       (with-output-as-gadget (stream)
>         (vertically ()
>           (make-gadget "one")
>           (make-gadget "two")
>           (make-gadget "three"))))
>
>     (run-frame-top-level (make-application-frame 'test-gadgets))
>
>     -- cut here --
>
>     hope this is helpful.
>
>     Regards,
>
>     Daniel
>
>
>     On 11.11.2017 21:49, John Morrison wrote:
>>     ugh - should attach what I said I attached
>>
>>     On Sat, Nov 11, 2017 at 3:48 PM, John Morrison
>>     <jm at symbolic-simulation.com <mailto:jm at symbolic-simulation.com>>
>>     wrote:
>>
>>         Hi Daniel (and Lucien, who replied privately):
>>
>>         (1) thanks for the "not dumb" comment.
>>
>>         Sorry additionally for not being clear.  The app is intended
>>         for the buttons (will eventually be checkboxes, but buttons
>>         were simpler for purposes of isolating the behavior) to be
>>         dynamic (unknown at layout time as things to be checked will
>>         come and go during program execution).
>>
>>         So while I did have some joy with making :list-panes with
>>         :items in the definition of the application frame (and it was
>>         prettier than what I sent), I had less joy changing those
>>         items programmatically.
>>
>>         When I put a "terpri" in as in the slightly revised test
>>         program as the other alternative, I get a blank line between
>>         the gadgets, which (given I am going to have a lot of items)
>>         would cause the user excess scrolling due to the whitespace
>>         between boxes.
>>
>>         -jm
>>
>>
>>
>>
>>         On Sat, Nov 11, 2017 at 3:24 PM, Daniel Kochmański
>>         <daniel at turtleware.eu <mailto:daniel at turtleware.eu>> wrote:
>>
>>             Hello John,
>>
>>             question is obviously not dumb. Some cognitive problem
>>             arises from the disparity, that McCLIM provides both
>>             sheets and gadgets. If you want to lay out buttons
>>             vertically, you may either put terpri after each
>>             make-pane, or put each button in your layout (the latter
>>             is more elegant imho):
>>
>>             -- cut --
>>
>>             (in-package :clim-user)
>>
>>             (defun make-gadget (item)
>>               (make-pane 'push-button
>>                          :label item
>>                          :activate-callback
>>                          (lambda (&rest args)
>>                            (declare (ignore args))
>>                            (notify-user *application-frame* "You
>>             clicked a button"))))
>>
>>             (define-application-frame test-gadgets ()
>>               ()
>>               (:panes)
>>               (:layouts
>>                (default (vertically ()
>>                           (make-gadget "one")
>>                           (make-gadget "two")
>>                           (make-gadget "three")
>>                           (make-gadget "four")))))
>>
>>
>>             (run-frame-top-level (make-application-frame 'test-gadgets))
>>
>>             -- cut --
>>
>>             Best regards,
>>
>>             Daniel
>>
>>
>>
>>             On 11.11.2017 21:07, John Morrison wrote:
>>
>>                 Hi;
>>
>>                 In another app I am writing, I BELIEVE gadgets used
>>                 to come out stacked vertically.  After an upgrade (to
>>                 current git), I think they come out "diagonally," in
>>                 that the x & y of successive gadgets increase
>>                 (presumbly by the dimensions of its preceding
>>                 gadget).  Please find attached the simplest test
>>                 program I could cons up that displays the behavior,
>>                 along with a screenshot that shows the behavior.
>>
>>                 What is the idiomatic/best way to get them to stack
>>                 vertically?  I messed about (again, mostly
>>                 unsuccessfully, or I wouldn't be pestering you all)
>>                 with various approaches, but every time I find myself
>>                 with a complex solution, it turns out there is indeed
>>                 a Better, Simpler Way.
>>
>>                 Thanks,
>>
>>                 -jm
>>
>>
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20171112/6875231b/attachment.html>


More information about the mcclim-devel mailing list