dumb question about gadgets
Daniel Kochmański
daniel at turtleware.eu
Sun Nov 12 20:44:55 UTC 2017
OK, thank you. That was a missing piece I needed. Fix was pushed to
master branch a second ago.
Best regards,
Daniel
On 12.11.2017 21:26, John Morrison wrote:
> Hi;
>
> So I think I misrepresented this (both to you and myself).
>
> Vintage commit abba473 respects the following, regardless of whether
> it is The Right Thing for me to ask of McCLIM:
>
> (with-output-as-gadget (stream :x 0) ....
>
> And the gadgets come out stacked vertically
>
> The next commit, e04adb3, AFAICT doesn't accept that:
>
> While evaluating the form starting at line 28, column 0
> of #P"/home/jm/tmp69/test-gadgets-v04.lisp":
>
> debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR in thread
> #<THREAD "main thread" RUNNING {10029568C3}>:
> keyword argument not a symbol:
> #<CLOSURE (FLET CLIM-INTERNALS::GADGET-OUTPUT-RECORD-CONSTRUCTOR
> :IN DISPLAY-GADGETS)
> {155549A4D62B}>.
>
> If I recall correctly, I did it because of this
> <http://bauhh.dyndns.org:8000/clim-spec/30-5.html#_1866> bit of the
> CLIM spec...
>
> Current vintage seems to accept the request without complaining, but
> does not honor it.
>
> That took an embarrassingly long time to track down.
>
> -jm
>
>
> On Sun, Nov 12, 2017 at 3:13 PM, Daniel Kochmański
> <daniel at turtleware.eu <mailto:daniel at turtleware.eu>> wrote:
>
> 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/5e322100/attachment-0001.html>
More information about the mcclim-devel
mailing list