Lisp HUG Maillist Archive

Buttons for text-input-panes

Hi,
I have a text-input-pane with a completion button. I'd like to change
the image on the button, but have had no luck. I have made an
external-image and registered it in the image translation table like
shown in the buttons.lisp example file.

So this now brings up a button with a calendar image on it:
(contain (make-instance 'push-button :image :calendar))

But this just shows a black square where the image should be:
(contain (make-instance 'text-input-pane :buttons '(:ok (:image :calendar))))

When creating the external-image (with make-instance 'external-image)
I had to use :transparent-color-index nil as setting it to a value
gives a "NIL is not of type ARRAY" error in
gp::%convert-dib when trying to use the image in a button.

This is all LWW 5.0.2
-- 
  -asbjxrn


Re: Buttons for text-input-panes

On 5/17/07, Asbjørn Bjørnstad <asbjxrn@bjxrnstad.net> wrote:

> When creating the external-image (with make-instance 'external-image)
> I had to use :transparent-color-index nil as setting it to a value
> gives a "NIL is not of type ARRAY" error in
> gp::%convert-dib when trying to use the image in a button.

This was the problem. A bitmap is not just a bitmap. My bitmap was
using 24bit colors. I've managed to convert the image into a 8-bit
bitmap and the buttons now work fine.

Except: Is it possible to enable/disable the ok/cancel/complete
buttons of a text-input-pane? Would be nice if they were
enabled/disabled along with the text-input-pane itself.
-- 
  -asbjxrn


Re: Buttons for text-input-panes

On 5/17/07, Dmitriy Ivanov <divanov@aha.ru> wrote:
> Hello Asbjørn,
>
> | Except: Is it possible to enable/disable the ok/cancel/complete
> | buttons of a text-input-pane? Would be nice if they were
> | enabled/disabled along with the text-input-pane itself.
>
> You can use the following approach (an excerpt from ywi-basics.lisp,
> the Ystok-Widgets project):
>
> (defgeneric (setf enabled) (value object)
> ...
> ;; for a pane equipped by buttons, affect the toolbar as well
> (:method :after (value (pane capi:text-input-pane))
>   (when-let (parent (capi:element-parent pane))
>     (when (eq (capi:capi-object-name parent)
>                  'CAPI::TEXT-INPUT-PANE-BUTTON-ROW)
>       (capi:map-pane-children parent
>         (lambda (child) (unless (eq child pane)
>            (setf (capi:simple-pane-enabled child) value))))))) ...)

Excellent. Thanks.
-- 
  -asbjxrn


Updated at: 2020-12-10 08:45 UTC