Button-handler and drawing

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Button-handler and drawing

Post by didi »

Can we draw after the gs:set-visible command ?

Code: Select all

 ( gs:draw-line 'L1 0 200 200 0 gs:green ) 
  
 (gs:set-visible 'Mdialog true )
 
 ( gs:draw-line 'L1 50 200 200 200 gs:blue ) 

 ( define ( ButtonRun-handler )
    ( println  "Button Run" )
    ( gs:draw-line 'L1 0 0 200 200 gs:red ) 
   ;( gs:set-background 'Mcanvas gs:green )
 )
This is only an example to show the effect . I can see the green line and even the blue line which is drawn after the set-visible command .
But i can not see the red line after pressing the run button .

If i minimize the Mdialog-window and then maximize it again i see the red line - or if i set the background after drawing to eg. green ( but not white what is already the background) .

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Put gs:update after the gs:draw-line command. This will force a repaint of Mcanvas.

Lutz

didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Post by didi »

Thankyou Lutz , it works well.

The next question , how can i get rid of all tags , is there a clear-canvas function ?

I have a clear-button, which should clear the canvas back to white .
First i've named all lines with the same tag-id , and i use gs:delete-tag, but with this i have no possibility to select single lines or tags . Brute force with gs:dispose 'Mcanvas doesn't work . Or should i generate a list of tags while drawing to delete them later ?

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

If you name all your tags with slightly varying names, you can presumably delete subsets of them, or all of them, by selecting groups of them first:

Code: Select all

(filter (fn (tag) (starts-with (name tag) "I")) (list 'In 'Ih 'Iq 'Id))
;-> (In Ih Iq Id)
; or
(map gs:delete-tag (filter (fn (tag) ....
Haven't tried this yet though...

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

That will work, but I would use strings for the tags and than have it easier filtering with regular expressions etc.

Wherever symbols are used in guiserver you can use strings instead. Symbols are nice because it is one quote less to type and looks better recognizable in syntax highlighted code. But for the kind of operation you want, the string is better.

Lutz

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

I have another question on this topic :-)

How do you access tags? I can see that you can keep a record of the ones that you use, but is there a way of getting the tags that have already been used? Can you obtain a list using some form of wildcard?

Locked