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
[4042x2]
I reported bugs with the radio-group here ..
and in the trac
Volker
24-Jun-2006
[4044]
if full naming is to much effort, maybe you could store the labels 
together with the data. not to find the right field, but to havea 
check to make sure. just in case. could also make datatypes more 
readable. just to make sure that the right femoral artery does not 
change to a left femoral artery just becaue somebody deleted a line.
Graham
24-Jun-2006
[4045]
this is a potential problem :)
Robert
24-Jun-2006
[4046]
We didn't checked against TRAC yet.
Graham
24-Jun-2006
[4047x3]
perhaps better to create an object and save it like that.
if 'face in the do-block refers to the layout, how to get this inside 
a button action block?
I want button [ unview/only parent-face ]
Ashley
24-Jun-2006
[4050]
unview/only face/parent-face
Ingo
24-Jun-2006
[4051]
Hi Graham, in my example-2 the the right-most text-lists keep their 
widths, and the lower text-lists keep their height, and the upper 
left text-list is maximized to fill the size of the window.
I would like to have equal sizes for all text-lists.
Graham
24-Jun-2006
[4052]
I am creating templates which I load up and display.  These templates 
contain some variables for label widths etc.  I have to bind the 
template to the variables, but then if I do that, operators such 
as '- have no context.  do I have to redefine '- and '+ etc?
Ashley
24-Jun-2006
[4053x3]
Ingo:


is there a reason, that display opens the windows, but does not start 
do-events?

 ... 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. I personally like having to code it explicitly as 
 it then stands out - "We are starting the event loop HERE".

Is it possible to get the window size?
 ... display [button do [ws: face/size]]

Is it possible to set an own resizer function?

 ... No, you'd have to change a lot of code to implement your own.

I would like to have equal sizes for all text-lists.

 The RebGUI resizing model is pretty basic, it supports one resizeable 
 widget in each axis (horizonal and vertical) with any number of offset 
 adjustments (the #XY directives). More advanced schemes (such as 
 proportional or percentage based) are possible, but significantly 
 harder to implement (and require size/state information to be retained).
Graham, I'd thought using () in the template would enable RebGUI 
to evaluate the expressions automatically for you. Do you have a 
small example of what you're trying to do?
Robert: Your rev#21 changes to rebgui-edit.r nuked my rev#19 and 
rev#20 changes ... but the good news is that they collectively constituted 
the following line in the insert-char function:


 unless any [insert? tail? view*/caret newline = first view*/caret] 
 [remove view*/caret]


Should I put that line back in a new rev or do you want to bundle 
that in with any additional changes you are working on?
Graham
24-Jun-2006
[4056x4]
Ashley, an imperfect example ...
do %rebgui.r


test: {label "This is a label" (width) radio-group data [ "-" "+" 
] return label "Another label" (width - 5)}

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


go test

do-events
it comes a cropper on the "-" ... ** Script Error: - word has no 
context
** Where: go
** Near: width - 5
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
[4091]
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.