Re: GUI components are disabled

2016-06-15 Thread Alexander Burger
Hi David,

> Alex, I still can't seem to get idForm to work even after looking at it in
> form.lDo I need something like:
> 
> (get (default *ID (val *DB)) 'nm)
> 
> like in family.l?

No, this is a bit non-standard, because the family GUI starts directly
into the 'person' view, without presenting the a dialog first.

Recommended is the way I outlined in my last mail:

   (menu ,"Title"
  (idForm ,"Title" '(choCls) 'nr '+Cls T '(may Delete) '((: nr) " -- " (: 
name))
 ... ) )

There is always a choose-dialog (called 'choCls' above) which allows the
user to search, and - if a desired object is not found - to press the
"New" button. In any case, the form will then start up with a proper
object.


> Can you please provide a small example of how to use
> idForm to create a new database object?  I feel the need to understand.

I suggest you look at the demo in the "app/" directory. Take, for
example, the '+Item' class

   (class +Item +Entity)
   (rel nr (+Need +Key +Number))  # Item Number
   (rel nm (+IdxFold +String))# Item Description
   ...

   (dm url> (Tab)
  (and (may Item) (list "app/item.l" '*ID This)) )

This 'url>' method links these objects to the form in "app/item.l".
There, in turn, we find

   (menu ,"Item"
  (idForm ,"Item" '(choItem) 'nr '+Item T '(may Delete) '((: nr) " -- " (: 
nm))
 ( 4

'choItem' is terribly complicated for the beginning.

Perhaps I better suggest the '+Sal' (salutation) class. The form file
"app/sal.l" is simpler, and the choose-dialog is just

   (de choSal (Dst)
  (choDlg Dst ,"Salutations" '(nm +Sal)) )

I hope this helps :)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: GUI components are disabled

2016-06-14 Thread David Bloom
Thank you Mattias and Alex.  Mattias, your reminder of using +Var like in
the tutorial when there isn't necessarily a db object yet was helpful.

Alex, I still can't seem to get idForm to work even after looking at it in
form.lDo I need something like:

(get (default *ID (val *DB)) 'nm)

like in family.l?  Can you please provide a small example of how to use
idForm to create a new database object?  I feel the need to understand.
Thank you again for all the speedy help.

-David Bloom



On Tue, Jun 14, 2016 at 1:35 AM, Alexander Burger 
wrote:

> Hi David, Mattias,
>
> > but the +TextField's use +E/R, which connects GUI components to database
> > objects. If I am not mistaken, +E/R uses a locking mechanism to stop
> > several users from changing objects at the same time. Usually, there is
> an
> > (editButton) involved to allow a user to lock the object, make
> > modifications and release the lock once the modifications are done. You
> can
> > find examples of this in the demo app shipped with the PicoLisp
> > distribution.
> >
> > Try changing these lines:
> >
> > (gui '(+E/R +TextField) '(name : home obj) 40 "Name")
> > (gui '(+E/R +TextField) '(email : home obj) 40 "Email")
> >
> > To this:
> >
> > (gui '(+Var +TextField) '*Name 40 "Name")
> > (gui '(+Var +TextField) '*EMail 40 "Email")
> >
> > This uses a '+Var' prefix class to connect the gui components to a
> variable
> > instead. This variable is used by (newButton) to create a new object.
>
> This is correct.
>
> When, however, David wants to edit DB objects, then the +E/R prefix is
> right. But then the 'form' needs an object to be enabled.
>
> The key is to call the 'idObj' function in the form. Usually this is
> done in a header like
>
>( NIL ( (: nm)))
>
> '' internally call 'idObj' which takes care of handling the DB
> objects. Another - more standard - way is to use 'idForm'
>
>(menu ,"Title"
>   (idForm ,"Title" '(chocls) 'nr '+cls T '(may Delete) '((: nr) " -- "
> (: name))
>  ... ) )
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: GUI components are disabled

2016-06-13 Thread Alexander Burger
Hi David, Mattias,

> but the +TextField's use +E/R, which connects GUI components to database
> objects. If I am not mistaken, +E/R uses a locking mechanism to stop
> several users from changing objects at the same time. Usually, there is an
> (editButton) involved to allow a user to lock the object, make
> modifications and release the lock once the modifications are done. You can
> find examples of this in the demo app shipped with the PicoLisp
> distribution.
> 
> Try changing these lines:
> 
> (gui '(+E/R +TextField) '(name : home obj) 40 "Name")
> (gui '(+E/R +TextField) '(email : home obj) 40 "Email")
> 
> To this:
> 
> (gui '(+Var +TextField) '*Name 40 "Name")
> (gui '(+Var +TextField) '*EMail 40 "Email")
> 
> This uses a '+Var' prefix class to connect the gui components to a variable
> instead. This variable is used by (newButton) to create a new object.

This is correct.

When, however, David wants to edit DB objects, then the +E/R prefix is
right. But then the 'form' needs an object to be enabled.

The key is to call the 'idObj' function in the form. Usually this is
done in a header like

   ( NIL ( (: nm)))

'' internally call 'idObj' which takes care of handling the DB
objects. Another - more standard - way is to use 'idForm'

   (menu ,"Title"
  (idForm ,"Title" '(chocls) 'nr '+cls T '(may Delete) '((: nr) " -- " (: 
name))
 ... ) )

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe