Re: +E/R and +Set
On Sat, Dec 07, 2019 at 08:10:56AM +0100, Alexander Burger wrote: > > "Title" (gui '(+E/R +TextField) '(ttl : home obj) 40) > > and > > "Title" (gui '(+Init +Set +TextField) (get *ID 'ttl) '((X) (put!> *ID 'ttl > > X)) 40) > > are equivalent inside an idForm? > > No, +E/R, +Init and +Set are all different. Getting something equivalent to the +E/R form is not trivial. It needs at least (gui '(+Set +Chk +Val +TextField) '((Val Dn) # 'Dn' is not needed here (only in charts) (=: er Val) (and (not (: lock)) (eval (: erObj)) (put!> @ (: erVar) Val) ) (extra Val Dn) ) '(or (extra) (and (eval (: erObj)) (mis> @ (: erVar) (val> This)) ) ) '(() (let Val (extra) (if (= Val (: er)) (get (eval (: erObj)) (: erVar)) Val ) ) ) 40 ) but this is not complete, as the GUI object is not properly initialized (class variables 'erObj' and 'erVar' and more, see the parent classes +/R (and +Able). You see, +E/R is a fairly complicated beast ;) ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: +E/R and +Set
Hi Kashyap, > Can you please confirm if > > "Title" (gui '(+E/R +TextField) '(ttl : home obj) 40) > and > "Title" (gui '(+Init +Set +TextField) (get *ID 'ttl) '((X) (put!> *ID 'ttl > X)) 40) > > are equivalent inside an idForm? No, +E/R, +Init and +Set are all different. +E/R is bi-directional, it sets the GUI from the DB, and writes back changes. +Init runs only once, during the HTTP GET transaction (i.e. not at POST transactions when a button was pressed). +Set is triggered whenever a value is *written to* the GUI (as opposed to +Val which triggers when a value is *fetched* from the GUI. Your combination of +Init and +Set means that when the page is loaded, the value is written immediately back to the DB, which is not nevessary. Such a side effect is better done in +Val (though +E/R does that better). ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
+E/R and +Set
Hi Alex, Can you please confirm if "Title" (gui '(+E/R +TextField) '(ttl : home obj) 40) and "Title" (gui '(+Init +Set +TextField) (get *ID 'ttl) '((X) (put!> *ID 'ttl X)) 40) are equivalent inside an idForm? Regards, Kashyap
Re: +QueryChart without pilog
Awesome ... the +Val also has the good sideeffect that the UI is updated to upper case :) It's wonderful to gather these PicoLisp nuggets of wisdom!!! Thanks Alex. Regards, Kashyap On Fri, Dec 6, 2019 at 6:41 AM Alexander Burger wrote: > On Fri, Dec 06, 2019 at 03:24:25PM +0100, Alexander Burger wrote: > >(gui 'tags '(+Var +Val +ListTextField) > > '*Tags > > '((L) (extract '((X) (uppc (pack X))) L)) > > '("," " ") > > 20 ) > > Ah, and of course +ListTextField already returns a list of strings, so the > 'pack' should not be necessary. > > Just > >'((L) (extract uppc L)) > > should be enough (not tested). > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: +QueryChart without pilog
On Fri, Dec 06, 2019 at 03:24:25PM +0100, Alexander Burger wrote: >(gui 'tags '(+Var +Val +ListTextField) > '*Tags > '((L) (extract '((X) (uppc (pack X))) L)) > '("," " ") > 20 ) Ah, and of course +ListTextField already returns a list of strings, so the 'pack' should not be necessary. Just '((L) (extract uppc L)) should be enough (not tested). ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: +QueryChart without pilog
On Thu, Dec 05, 2019 at 07:11:43PM -0800, C K Kashyap wrote: > Okay, my choTask looks like this now - as you can see, I assigned a list > to @Names and then assigned the 'car' of the list to @Key. The way I > avoided repetition was by assigning to a global symbol '*Names' - is that > reasonable? > > > "Tags" (gui 'tags '(+Var +ListTextField) '*Tags '("," " ") 20 ) > (searchButton '(init> (: home query))) ) > (gui 'query '(+QueryChart) *ROWS > '(goal > '(@Names (setq *Names (filter prog (mapcar '((X) (uppc (pack X))) > *Tags)) ) >@Key (car *Names) Yes, this works, but I agree that using a global does not feel right. I would suggest to handle it directly in the GUI ... "Tags" (gui 'tags '(+Var +Val +ListTextField) '*Tags '((L) (filter prog (mapcar '((X) (uppc (pack X))) L))) '("," " ") 20 ) ... so that '*Tags' immediately has the filtered uppercase values. Also, we can avoid mapping the list twice (mapcar and then filter). 'extract' is intended for such cases: (gui 'tags '(+Var +Val +ListTextField) '*Tags '((L) (extract '((X) (uppc (pack X))) L)) '("," " ") 20 ) ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe