[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ctview / column



More or less, Philippe wrote:  why does the following code not do anything ? ]

In article <1996Mar28.101643.6372@sophia.inria.fr>, ladagnou@irit.fr (Philippe LADAGNOUS) writes:
|> (setq ct (map-ctview "as" () () () () () () ()))
|> (de :add-command-buttons ()
|>     (lets
|>      ((apply ({butobj}:create 0 0 (view (centeredimage 0 0 60 15 "apply")
|>                                         (box 0 0 60 15)) ':apply))
|>       (goal ({butobj}:create 0 0 (view (centeredimage 0 0 60 15 "goal")
|>                                        (box 0 0 60 15)) ':goal))
|>       (row1 (fixrow apply goal)))
|>      (send 'hide-frame ct)
|>      ({editor-view}:add-to-column ct row1 0)
|>      (send 'show row1)
|>      (send 'show-frame ct)))

|> (:add-command-buttons)

|> P.S: si au lieu d'inserer "row1" on insere un bouton, cela fonctionne.
|>      Ces 2 types d'objets auraient-ils des status differents?

Right, we'll the first thing to note is that if you want the objects
to appear then you must send "show" to them.

In fact the version where you see two buttons appear as toplevel objects
is not the one given above but is rather when you include:
	(send 'show apply)
	(send 'show goal)
These two lines.  

The main problem with the code above is that the object added is not 
a "graphical object" as sited in the doc.  The graphical object has a 
window associated to it, which becomes a subwindow of the editorview
itself.  Your code as an imagine the windows nested lower in the image
are not properly parented ---they don't know who their father window is.

[ i include the bit from the doc.
({editor-view}:add-to-column  editor-view object [position]integer)
     ! object
   Adds an object to the editor-view's left column at the given posi-
   tion (starting at 0). If no position is given, the object is added at
   the end. If the column was previously empty then the vline separator
   is resized. Returns object. N.B. The object need not be a button;
   it may be any graphical object.
]

;;; The function which rather than adding an image, adds a graphical 
;;; object would be the following

(de :add-command-buttons ()
    (lets
     ((apply ({butobj}:create 0 0 (view (centeredimage 0 0 60 15 "apply")
                                        (box 0 0 60 15)) ':apply))
      (goal ({butobj}:create 0 0 (view (centeredimage 0 0 60 15 "goal")
                                       (box 0 0 60 15)) ':goal))
      (row1 (fixrow apply goal))
      (gobj ({gfxobj}:create 0 0 () () row1)))
     (send 'show apply)
     (send 'show goal)
     (send 'show gobj)
     (send 'hide-frame ct)
     ({editor-view}:add-to-column ct gobj 0)
     (send 'show-frame ct)))


This should solve your problem. 

	regards
	janet