Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - alexr

#1
newLISP Graphics & Sound /
September 09, 2008, 07:08:04 AM
Okay found it in /usr/share/newlisp/guiserver. I must have missed it in the docs.
#2
newLISP Graphics & Sound /
September 09, 2008, 06:50:17 AM
QuoteYou may also want to look into the gs:tabbed-pane control. There is a demo about this in tabs-demo.lsp. These are nice when you need to switch beck and forth between different forms.


I'm running on OSX and just installed the latest (9.4.5). Where is tabs-demo.lsp?



Thanks

Alex
#3
newLISP Graphics & Sound /
September 09, 2008, 05:11:31 AM
Instead of making the other components dialogs, can I make them panels instead and add those to my application frame?



Something like:


;;; run
(define (run)
(begin
(gs:init)
(gs:frame 'Main 200 200 320 480 "Main")
(setq p1 (pane1 'app:got-event))
(setq p2 (pane2 'app:got-event))
(gs:add-to 'Main 'p1)
(gs:set-visible 'Main true)
(gs:listen)))

;; go
(run)


and in my pane1.lsp and pane2.lsp files:
(define (pane1:pane1 cbak)
(begin
(gs:panel 'pane1)
(gs:button 'Btn1 cbak "OK 1")
(gs:add-to 'pane1 'Btn1)))


Rhetorical question actually, because I just tried and get an error message:

add-to app:Main app:p1 : Could not invoke method add-to with app:Main
#4
I am a newcomer to newlisp and am not sure how to break my code up in modules when it comes to gui forms.



The app I'd like to write will need a few forms and I would like to save each form definition (hence calls to gs: functions) in its own file. Actions local to each form would be defined within that form's file. Other actions would ideally be defined as passing control to some controller defined in the main file.



I tried the code below, but it fails and reports the following error:
ERR: symbol is protected in function setq : callback
called from user defined function form1
called from user defined function app:run


My code goes like this:

#!/usr/bin/env newlisp

; app.lsp
;

;; load modules
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
(load "form1.lsp")
(load "form2.lsp")

;; definitions
(context 'app)

;;; handlers
(define (app:got-event id value)
(begin
()))

;;; run
(define (run)
(begin
(setq f1 (form1 'app:got-event))
(setq f2 (form2 'app:got-event))
(gs:set-visible 'f1 true)
(gs:listen)))

;; go
(run)


Form1 file goes like this:

#!/usr/bin/env newlisp

; form1.lsp
;

;; load modules
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))

;; definitions
(context 'form1)

(define (form1:form1 callback)
(begin
(gs:init)
(gs:frame 'Form1 200 200 320 480 "Form 1")
(gs:button 'Btn1 callback "OK 1")
(gs:add-to 'Form1 'Btn1)))


Thanks in advance,

Alex