Lisp HUG Maillist Archive

Item in tree-view pane-menu callbacks on Linux and tree-view state image lists

Hi everyone,

 

I’m porting a largish CAPI code-base from Windows MDI to Linux using LispWorks 7.1.1, which has gone surprisingly well so far (so a big kudos to LispWorks for their nice CAPI).

 

However I’ve run across two issues related to capi:tree-view, where I’ve not found something enlightening in the docs and this mailing list:

 

  • On Windows the pane-menu callback is passed the proper item that the user clicked on; however on Linux/GTK it seems that the item is always nil and there does not seem to be a good way to work-around this (other than switching to using the current selection, which is however updated too late in the callback sequence, or hand-calculating the item from the coordinates). Is this a known limitation/problem, or am I just missing something? The docs do not seem to suggest a difference in behavior here?
  • On Windows when using :use-state-images, I need to pass in an :image-lists argument specifying both :normal and :state image-lists, which are respectively used for image and state images. On Linux it seems that the display indexes into the :normal image-list even for the indices returned by :state-image-function; however it does seem to check those indices against the size of the :state image-list, so maybe this is just a bug? Or is this an expected deviation? I.e. the following code seems to work OK on Windows, but shows the wrong state images (using ones from :normal) on Linux/GTK:

 

    :use-images t

    :use-state-images t

    :image-lists (list :normal (get-image-list 'fmu-tree #P"fmu-tree.bmp" 20 16 16)

                       :state (get-image-list 'fmu-tree-state #P"fmu-tree-state.bmp" 3 16 16))

    :image-function #'ui-item-image-index

    :state-image-function #'(lambda (item) (if (atom item)

                                               (if (typep item 'fmu-variable-instance)

                                                   (if (fmu-variable-instance-exposed-as item)

                                                       2

                                                     1)

                                                 0)

                                             0))

 

 

Can anyone give any pointers on these two issues, or is there agreement that one or both are just bugs? Thanks,

 

Regs, Pierre.

 

--

Pierre R. Mai                                        <pmai@pmsf.de>

PMSF IT Consulting Pierre R. Mai                http://www.pmsf.de/

Blumenstr. 4 / Büro Waldweg 4                         Goethestr. 32

85417 Marzling                                     87724 Ottobeuren

Tel. +49(0)8161/976 96 - 11                    +49(0)8332/936 69 13

Fax  +49(0)8161/976 96 - 51                    +49(0)8332/936 69 03

Germany                            VAT ID / USt-ID Nr: DE 212838159

 

Re: Item in tree-view pane-menu callbacks on Linux and tree-view state image lists

Yes, the pane-menu callback is always called with nil to GTK.  I'm not sure if
that is a bug or not, but I don't see any problem with using
capi:choice-selected-item in the function (LispWorks does this in the Debugger
backtrace to show a different menu for functions and variables).

The problem with state images is a bug that we will fix.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/


>>>>> On Mon, 13 Aug 2018 14:31:00 +0200, Pierre R Mai said:
> 
> Hi everyone,
> 
> I'm porting a largish CAPI code-base from Windows MDI to Linux using
> LispWorks 7.1.1, which has gone surprisingly well so far (so a big kudos to
> LispWorks for their nice CAPI).
> 
> However I've run across two issues related to capi:tree-view, where I've not
> found something enlightening in the docs and this mailing list: 
> 
> *	On Windows the pane-menu callback is passed the proper item that the
> user clicked on; however on Linux/GTK it seems that the item is always nil
> and there does not seem to be a good way to work-around this (other than
> switching to using the current selection, which is however updated too late
> in the callback sequence, or hand-calculating the item from the
> coordinates). Is this a known limitation/problem, or am I just missing
> something? The docs do not seem to suggest a difference in behavior here?
> 
> *	On Windows when using :use-state-images, I need to pass in an
> :image-lists argument specifying both :normal and :state image-lists, which
> are respectively used for image and state images. On Linux it seems that the
> display indexes into the :normal image-list even for the indices returned by
> :state-image-function; however it does seem to check those indices against
> the size of the :state image-list, so maybe this is just a bug? Or is this
> an expected deviation? I.e. the following code seems to work OK on Windows,
> but shows the wrong state images (using ones from :normal) on Linux/GTK:
> 
>  
> 
>     :use-images t
>     :use-state-images t
>     :image-lists (list :normal (get-image-list 'fmu-tree #P"fmu-tree.bmp" 20 16 16)
>                        :state (get-image-list 'fmu-tree-state #P"fmu-tree-state.bmp" 3 16 16))
>     :image-function #'ui-item-image-index
>     :state-image-function #'(lambda (item) (if (atom item)
>                                                (if (typep item 'fmu-variable-instance)
>                                                    (if (fmu-variable-instance-exposed-as item)
>                                                        2
>                                                      1)
>                                                  0)
>                                              0))
> 
> Can anyone give any pointers on these two issues, or is there agreement that
> one or both are just bugs? Thanks,
> 
> Regs, Pierre.
> 
>  
> 
> -- 
> Pierre R. Mai                                         <pmai@pmsf.de>
> PMSF IT Consulting Pierre R. Mai                 http://www.pmsf.de/
> Blumenstr. 4 / Büro Waldweg 4                         Goethestr. 32
> 85417 Marzling                                     87724 Ottobeuren
> Tel. +49(0)8161/976 96 - 11                    +49(0)8332/936 69 13
> Fax  +49(0)8161/976 96 - 51                    +49(0)8332/936 69 03
> Germany                            VAT ID / USt-ID Nr: DE 212838159

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

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