gs:set-border-layout not working as expected...

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE

gs:set-border-layout not working as expected...

Postby oofoe » Sun Jan 13, 2013 4:36 am

Hi!

This may just be that I'm not reading the documentation closely enough, however if I understand correctly, the "border" layout style allows five sections -- north, south, east, west and center -- and they should work together.

So, this piece of code should show a red box on top, with the bottom divided evenly between a green box on the left and a blue box on the right.

Instead I get a single blue box that fills the entire frame. Any ideas? Thanks!

Code: Select all
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))

(gs:init)
(gs:set-trace true)
(gs:set-look-and-feel "javax.swing.plaf.metal.MetalLookAndFeel")

(gs:frame 'main 100 100 512 512 "Layout Test")

(gs:set-border-layout 'main)

(gs:panel 'i1 100 100)  (gs:set-color 'i1 1 0 0)
(gs:panel 'i2 100 100)  (gs:set-color 'i2 0 1 0)
(gs:panel 'i3 100 100)  (gs:set-color 'i3 0 0 1)

(gs:add-to 'main 'i1 'north  'i2 'west  'i3 'east)

(gs:set-visible 'main true)
(gs:listen)


I've tried using separate (gs:add-to) calls and putting the panels inside an inset panel with the border layout, but nothing seems to work. By the way: newLisp v10.4.4, newLISP-GS v.1.47 on Windows 7
Testing can show the presence of bugs, but not their absence.
oofoe
 
Posts: 60
Joined: Wed Sep 28, 2005 7:13 pm

Re: gs:set-border-layout not working as expected...

Postby oofoe » Sun Jan 13, 2013 4:55 am

OK, figured it out almost as soon as I posted. The problem is that the canonical directions (north, south, etc.) must be strings. Can't be symbols that I expect to be converted to strings, must absolutely, positively only be strings.

For what it's worth, I think this is a bug in light of the "String constants for type and orientation constants can be given as symbols" shortcut method mentioned in the documentation.

However! In the meantime, this is all I had to change to get it to work:

Code: Select all
(gs:add-to 'main 'i1 "north"  'i2 "west"  'i3 "east")
Testing can show the presence of bugs, but not their absence.
oofoe
 
Posts: 60
Joined: Wed Sep 28, 2005 7:13 pm

Re: gs:set-border-layout not working as expected...

Postby Lutz » Sun Jan 13, 2013 3:50 pm

Thanks for catching this. The online documentation has been corrected.

The text regarding orientation labels referred to an older version of software. Now, only ids may be expressed as either symbols or strings.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: gs:set-border-layout not working as expected...

Postby oofoe » Mon Jan 14, 2013 6:42 am

Thanks for the update!

For what it's worth, the GUI documentation would really benefit from more code examples like the main NewLisp manual. If you feel it's sufficiently clear, please feel free to use my test program for gs:set-border-layout!

If you're interested in having more runnable examples for other GUI server functions, I would be happy to supply you with more -- I'm currently hacking a new program up and have been studying the GUI stuff intensively lately.
Testing can show the presence of bugs, but not their absence.
oofoe
 
Posts: 60
Joined: Wed Sep 28, 2005 7:13 pm

Re: gs:set-border-layout not working as expected...

Postby Lutz » Mon Jan 14, 2013 1:26 pm

At the moment the GUI documentation is part of the guiserver.lsp module and this module file would get too heavy, if the documentation gets too big. Perhaps it is time to make a separate HTML manual and leave the guiserver.lsp module as light as possible for fast loading?

The best way to study the GUI server, is to run read the demo programs accessible from the Help menu of the IDE application and from the following directories:

Code: Select all
; on OSX and UNIX
/usr/share/newlisp/guiserver/

; on Windows
c:/Program Files/newlisp/guiserver/


Cormullion has some additional example code in his Introduction to newLISP here:

http://en.wikibooks.org/wiki/Introducti ... _interface
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP Graphics & Sound

Who is online

Users browsing this forum: No registered users and 3 guests

cron