Re: [Factor-talk] Radio-buttons not working

2012-12-27 Thread Samuel Proulx
I see. Thank you!

Le jeudi 27 décembre 2012, Jon Harper a écrit :

> As stated in the documentation of "gadget", you can't use the children
> slot directly:
> "children - a vector of child gadgets. Do not modify this vector directly,
> instead use add-gadget, add-gadgets, unparent or clear-gadget."
>
> In your case,
> replacing " 1vector >>children relayout" with "[ clear-gadget ] [ 
> add-gadget ] bi" solves the problem.
>
> In your particular case, the parent of the child gadget was not correctly
> set to the viewport, which breaks clicks on buttons. Also, the
> initialization code (see graft*) of the child gadget was not run, so models
> were not properly activated and linked
>
> Cheers,
> Jon
>
>
> Jon
>
>
> On Thu, Dec 27, 2012 at 6:37 PM, Samuel Proulx 
> 
> > wrote:
>
>> Hi,
>>
>> I just made the following scroller containing two radio-buttons:
>>
>> SYMBOL: model f  model set
>> :  ( -- test ) model get { "True" "False" }   { 4
>> 4 }  ;
>>   dup gadget.
>>
>> It works fine when I click on the buttons. Although, If I try to change
>> the viewport of the scroller (even to the exact same thing), the buttons
>> suddently stop working:
>>
>> dup viewport>>  1vector >>children relayout
>>
>> What did I do wrong ?
>>
>> Thanks in advance,
>> Samuel
>>
>>
>>
>> --
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. ON SALE this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122712
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net > 'Factor-talk@lists.sourceforge.net');>
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Radio-buttons not working

2012-12-27 Thread Jon Harper
As stated in the documentation of "gadget", you can't use the children slot
directly:
"children - a vector of child gadgets. Do not modify this vector directly,
instead use add-gadget, add-gadgets, unparent or clear-gadget."

In your case,
replacing " 1vector >>children relayout" with "[ clear-gadget ] [ 
add-gadget ] bi" solves the problem.

In your particular case, the parent of the child gadget was not correctly
set to the viewport, which breaks clicks on buttons. Also, the
initialization code (see graft*) of the child gadget was not run, so models
were not properly activated and linked

Cheers,
Jon


Jon


On Thu, Dec 27, 2012 at 6:37 PM, Samuel Proulx wrote:

> Hi,
>
> I just made the following scroller containing two radio-buttons:
>
> SYMBOL: model f  model set
> :  ( -- test ) model get { "True" "False" }   { 4
> 4 }  ;
>   dup gadget.
>
> It works fine when I click on the buttons. Although, If I try to change
> the viewport of the scroller (even to the exact same thing), the buttons
> suddently stop working:
>
> dup viewport>>  1vector >>children relayout
>
> What did I do wrong ?
>
> Thanks in advance,
> Samuel
>
>
>
> --
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Radio-buttons not working

2012-12-27 Thread John Benediktsson
You probably want to use "unparent" to remove the current children from the
viewport instead of just changing the children slot (it does a few
bookkeeping things).

Also, viewports seem to require the children>> slot to have at least one
child in it or they throw an exception in layout.

It's maybe not as nice as you'd like, but this will "work":

  dup gadget.

: replace-children ( viewport newchild -- )
add-gadget children>> but-last [ unparent ] each ;

dup viewport>> "foo"  replace-children

dup viewport>>  replace-children

We should fix the bug to make viewports allow zero children so you don't
have to "add then remove others", but this works fine I think.

Best,
John.



On Thu, Dec 27, 2012 at 9:37 AM, Samuel Proulx wrote:

> Hi,
>
> I just made the following scroller containing two radio-buttons:
>
> SYMBOL: model f  model set
> :  ( -- test ) model get { "True" "False" }   { 4
> 4 }  ;
>   dup gadget.
>
> It works fine when I click on the buttons. Although, If I try to change
> the viewport of the scroller (even to the exact same thing), the buttons
> suddently stop working:
>
> dup viewport>>  1vector >>children relayout
>
> What did I do wrong ?
>
> Thanks in advance,
> Samuel
>
>
>
> --
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Radio-buttons not working

2012-12-27 Thread Samuel Proulx
Hi,

I just made the following scroller containing two radio-buttons:

SYMBOL: model f  model set
:  ( -- test ) model get { "True" "False" }   { 4 4
}  ;
  dup gadget.

It works fine when I click on the buttons. Although, If I try to change the
viewport of the scroller (even to the exact same thing), the buttons
suddently stop working:

dup viewport>>  1vector >>children relayout

What did I do wrong ?

Thanks in advance,
Samuel
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk