AltME: R3-GUI

Messages

GrahamC
I had my client running for 4.5 hours.  Just sitting there and downloading the SO chat messages every 5 seconds but NOT updating the GUI.  No crashes.  But as soon as I changed the code to update the GUI, it crashed.

Luis
How to write this line in  rebol3 ? :  view layout [  button "x: 123" [x: 123]   button "print x"[ print x ] ]
Bo
I haven't done much with R3-GUI yet, but I think it's something like this:
view layout [  button "x: 123" on-action [x: 123]   button "print x" on-action [ print x ] ]

Luis
In Rebol3 after press "x: 123" button  pressing "print x" button I get: ** Script error: x has no value  ... ( REBOL/version 2.101.0.3.1 saphir-view)
Endo
You should use SET:
view [button "a" on-action [x: 123]] print x  ; ** error
view [button "a" on-action [set 'x 123]] print x ; == 123
This is because layout block is used by a FUNCT (makes every set word local to function) I think.
Cyphre
Luis the set-word!s in  on-action blocks are by default defined as local variables. That's why "x has no value". The correct version is then:
view [
    button "x: 123" on-action [set 'x 123]
    button "print x" on-action [print x]
]
or you can use for example contexts (and other variations):
ctx: context [
    x: none
]
view [
    button "x: 123" on-action [ctx/x: 123]
    button "print x" on-action [print ctx/x]
]
Robert
I really don't like this SET XYZ style. IMO it would be nice to have:
local-set-word:
global-set-word::
Cyphre
This is normal REBOL behaviour..it's nothing special that was invented by R3GUI :-) So either we switch the actors to be normal FUNCs or get used to have FUNCTs
I don't think is is a good decission to intorduce some non-rebol-compatible syntax here (fcourse unless there is wide agreement on that at the REBOL language level).
Also IMO it's much safer to get error when you access 'global' valirable that is not exposed than get no error when your local variable is already leaked.
Robert
I got this, my comment was (not very clear) to use the :: notation on the language level.
Cyphre
Aha, so then let's discuss that in R3 group or add new feature request on R3 Github repo.
But I personally think it doesn't matter if you write: a:: 10 or set 'a 10 or anything else to let R3 that the variable is 'global'. That doesn't change the fact you need to know first the actor blocks use set-word!s as local by default.
Geomol
Double colon syntax is taken, I guess:
>> type? first [a::]
== url!
I'm not sure, but maybe the view dialect should just set vars globally, if they're not found locally?
Geomol
Even if having a ton of global variables isn't viewed as something desirable by many (myself included). I guess, that's why it was changed from R2 to R3?
An alternative could be, that vars set in the dialect could end up in a special context for that purpose, and that this context is searched too, when vars are used in the dialectc.
Maxim
please don't rebind the blocks manually.  if the action uses 'SET its for a purpose.  furthermore, using 'SET doesn't mean that the value is set within a "global" space.  it means so set that word as it is bound already (which may have been bound manually by the user).  
if he uses a set-word, then that could be localized, as per current funct and object creation rules.
Gregg
I don't like the double colon syntax at first glance.

GrahamC
Has there been any progress on determining this TCP/IP bug #9910 ?
Cyphre
I don't think so or at least I don't know about anyone who picket that up so far. But its a critical one so I believe it will be fixed very soon.
=picked

Last message posted 266 weeks ago.