r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!RebGUI] A lightweight alternative to VID

Graham
24-Jun-2006
[4059]
test: {label "This is a label" (width) radio-group 24x4 data [ "-" 
"+" ] return label "Another label" (width - 5)}

go: func [ template [string!] 
	/local width
][
	width: 30
	template: compose bind to-block template 'width
	display "testing ..." compose/deep [
		(template)
	]
]

go test
do-events
Ashley
25-Jun-2006
[4060]
Always a problem when working with string representations of a dialect. 
Try:

go: func [ template [string!]][
	width: 30
	display "testing ..." load template
]


Although this depends on width being global. But since you're working 
with strings anyway, why not forget binding and go with simple variable 
substitution as in:

	...
	replace/all template "%width%" 30
	...


with appropriate markers to prevent accidental partial replacements.
Graham
25-Jun-2006
[4061x2]
what's the safest way to allow users to create templates in rebgui 
and not allow them to put executeable code in it?
which is why i was not using 'load
Ashley
25-Jun-2006
[4063]
Safest way is to put a front-end on that precludes free-form string 
entry! ;)
Graham
25-Jun-2006
[4064x8]
I know that you do that - with a gui layout editor.
seems a lot of hardwork though!
reset: func [ value /local type ][
    foreach f face/parent-face/pane [
        if f/type = 'group-box [    
            foreach widget f/pane [    
                type: form widget/type
                switch type [
                    "field" [ show-text widget copy "" ]
                    "area" [show-text widget copy "" ]
                    "edit-list" [ show-text widget copy "" ]

                    "radio-group" [ widget/select-item value]                
                ]
            ]    
        ]
    ]
]
this is a function to reset some of the widgets inside a group-box 
.. doesn't work though
** Script Error: Cannot use path on none! value
** Where: reset
** Near: foreach f face/parent-face/pane [
    if f/type = 'group-box [
        foreach widget f/pane [
            type: form wi...
this function is an action for a button inside the same layout
this code though works if included as is inside the button action 
.. but not when used as a function
radio-group/select-item 0 doesn't work ... doesn't allow you to set 
the radio-group to a state where none is selected
Robert
25-Jun-2006
[4072]
rebgui-edit.r: We have merged it and IIRC Cyphre wanted to sync it. 
But I check the repository.
Volker
25-Jun-2006
[4073x2]
what's the safest way to allow users to create templates in rebgui 
and not allow them to put executeable code in it?
 http://polly.rebol.it/test/test/game/use/game/unbind.r
(needs testing)
Graham
25-Jun-2006
[4075]
exactly how does it work?
Volker
25-Jun-2006
[4076x3]
makes an empty context for all known words and binds the loaded block 
to it. including words inside objects and functions.
and could be extended to keep some words bound.
in a way like to-block with hooks.
Graham
25-Jun-2006
[4079]
actually the way it works now, since I have to bind the block to 
my local variables, doesn't that mean I have adequate protection?
Graham
26-Jun-2006
[4080]
Is there a way to control the sort display for a table?
Robert
26-Jun-2006
[4081]
programatically?
Graham
26-Jun-2006
[4082]
yeah
Robert
26-Jun-2006
[4083]
no, not that I know.
Graham
26-Jun-2006
[4084]
so, have to simulate mouse clicks on the table header I guess
Robert
26-Jun-2006
[4085]
Take a look at the source. I think it's a flag and if you than do 
a /redraw it should be sorted.
Graham
26-Jun-2006
[4086]
Ok.
Henrik
26-Jun-2006
[4087]
I had a very quick glance at RebGUI widgets. Would it be possible/easier 
to implement LIST-VIEW as a widget?
Graham
26-Jun-2006
[4088]
You're welcome to try ...
Anton
26-Jun-2006
[4089]
Henrik, I suggest first convert your list-view from being based on 
BOX to being based on FACE. Then it's slightly less work to port 
to rebgui.
Henrik
26-Jun-2006
[4090]
alrighty then
Anton
26-Jun-2006
[4091x2]
also, I don't think it's any easier to create a list style using 
VID or REBGUI - the same basic issues are there, but porting to rebgui 
is fairly straightforward. Just keep the rebgui source handy as you 
will need to dip into it a few times.
http://home.wilddsl.net.au/anton/rebol/rebgui/differences-from-VID.txt
Robert
26-Jun-2006
[4093]
Henrik, looking forward to see your first version of the list-view 
widget.
Henrik
26-Jun-2006
[4094]
please don't hold your breath :-) I've barely played with the RebGUI 
demo
Robert
26-Jun-2006
[4095]
That's the soft way of community pressure ;-)) I'm quite sure it's 
not that hard to get into RebGUI development.
Pekr
26-Jun-2006
[4096]
Is tree-view planned Robert?
Robert
26-Jun-2006
[4097]
It's mostly done (90%) as there is a complete tree in the drop-tree 
widget. We just didn't extract the code into a stand-alone widget 
as I don't need it at the moment. Feel free to go for it.
Thør
26-Jun-2006
[4098]
.
Ingo
26-Jun-2006
[4099x2]
Ashley ...

[me] "is there a reason, that display opens the windows, but does 
not start do-events?" [ashley] ... we can't assume the "first" window 
automatically needs to start the event loop. Perhaps the display 
is being assigned to a word and cached for later use? Or the display 
is done early in the script for lots of subsequent initialization 
and *then* needs to fire up the event loop.

Right, that's it! 


As I see it, there are 3 distinct actions: layout, display, handle 
the events.


With view I can do the layout independently from display and event-handling. 
With rebgui I can't, because display does the layout _and_ display, 
and then I'm stuck with a dysfunctional window. So I can't do a layout 
to assign it to a subpane somewhere, it's instantly displayed as 
it's own window.
Is it possible to get the window size?
 ... display [button do [ws: face/size]]


this always returns 100x100, I guess it is run before the actual 
window size is really computed.

>> display "test" [text "hi" do [s: face/size f: face]]
>> s
== 100x100
>> f/size
== 48x52
Graham
26-Jun-2006
[4101]
display was supposed to return a layout and not display as an refinement. 
 It does not.  But it can be changed to do this.
Gordon
26-Jun-2006
[4102x2]
why do the RebGUI examples quit right away?
Ex:
Rebol []
do %rebgui.r

display/close "Example" [
    text "Closing the window will change its title."
] [show-title face "Closing ..." wait 1]
I have to add a 'halt' in order to see any of the examples but then 
the examples don't work!
Henrik
26-Jun-2006
[4104x2]
gordon, because you need to add do-events at the end
(for some reason I'm unaware of at this time)
Gordon
26-Jun-2006
[4106x2]
Thanks.  I'll give it a try
Yep.  That worked.  Thanks again.
Pekr
27-Jun-2006
[4108]
how do you usually aproach encapping your app using RebGUI?