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
2-May-2006
[3523x3]
I think I am using an older version of rebgui ...
not the one from the svn.
So, I need now to track down the older source for the area widget
Anton
2-May-2006
[3526]
Use SVN, then you can see the changes. Or are you locked to an older 
version ?
Graham
2-May-2006
[3527x4]
I'm sortof locked into an older version as I put some changes in 
to it .. more error trapping, extra fields in widgets etc.  I guess 
I'll have bit the bullet.
I updated my version to latest, ran the create-distribution script, 
and then tour.r
Script: "RebGUI widget tour" (30-Apr-2006)
** Script Error: unit-size has no value
** Where: init
** Near: as-pair unit-size * 1.5 unit-size
anyone got a checked version working with tour.r?
Ashley
2-May-2006
[3531]
Works for me, I think its your version of tour.r that's the problem 
(should be 0.4.2).
Graham
2-May-2006
[3532x10]
Yes, you were corrrect Ashley.
Would you check in a version of Tour.r into the SVN ( and the images 
as well ) ?
When trying to set the value of a radio group, I usually got an error 
about pf being none
so, I had this in my radio-group definition
down [
								pf: face/parent-face
								either all [ found? pf pf/data <> face/data ][
									;	deflag old
									old: pf/data
									if old [
										clear skip pf/pane/:old/effect/draw 7
										show pf/pane/:old
									]
									;	flag new
									pf/data: face/data

         insert tail face/effect/draw compose [pen (colors/true) fill-pen 
         (colors/true) circle (as-pair sizes/cell * 1.5 sizes/cell * 2.5) 
         (sizes/cell - 1)]
									show face
									pf/action pf
								][ ;; GC

          insert tail face/effect/draw [pen leaf fill-pen leaf circle (as-pair 
          sizes/cell * 1.5 sizes/cell * 2.5) (sizes/cell * 1.5)]
										show face
										face/action face
								]
I didn't make any notes, but it checks to see if pf is none or not, 
and if none, does the alternate action.
I didn't see a way of creating layouts with no borders, so, in rebgui-display.r, 
line 50, I added this to the list of refinements
/options

 opts [block!]	"Window options [no-title no-border resize] (must be: 
 block word)"
and at line 112, changed the block to read
either dialog [
		unless no-hide [
			hide-popup ; workaround until /away and parent options work
		]
		show-popup view-face
	][
		either options [
			view/new/options view-face opts
		][
			view/new view-face
		]
	]
Robert
2-May-2006
[3542]
Did you uploaded those patches as well?
Graham
2-May-2006
[3543x2]
No, I haven't sought an account.
I'd rather people vet my code first .. I'm just not too familiar 
with the rebgui internals.
Henrik
2-May-2006
[3545]
does rebgui have a toolbar widget?
Graham
2-May-2006
[3546]
There is one in the tour.r so I guess so.
Henrik
2-May-2006
[3547]
ok
Graham
2-May-2006
[3548]
How would one provide function keys that are globally accessible? 
 I want to make F1 a help key that is context sensitive ( sensitive 
to which pane has focus etc )
Anton
3-May-2006
[3549x3]
In VID you would just assign a key to the window face:
view layout [key #"^t" [print system/view/focal-face/var] my-field: 
field do [focus my-field] fld2: field]
(with some difficulty getting F1 to work maybe)
Graham
3-May-2006
[3552]
Does anyone use function keys in their applications these days?
Anton
3-May-2006
[3553]
My apps are generally small, and I consider function keys as an optimization, 
which means my apps usually reach a usable state before I get round 
to adding function keys, and so I never get round to adding them. 
:) I have one or two apps which use them, I think.
Graham
3-May-2006
[3554]
If Ashley couple pipe in here as to how this might be done, that 
would be appreciated.
Anton
3-May-2006
[3555x5]
Well, the event arrives first in the window feel, so look in there:
>> win: display "" [] ; now press escape
>> probe win/feel
make object! [
    redraw: none
    detect: func [face event][
        switch event/type [
            key [edit/process-keystroke face event]
            move [mouse-offset: event/offset] ...

hence
>> probe get in ctx-rebgui/edit 'process-keystroke
So, the bottom of process-keystroke handles all other keys than tab 
or space, and it looks in the keycodes facet of the window to cause 
an action.
This is a bit hacky but it works:
win: display "" [text "hello" #"t" [print "hi"]]   win/keycodes/1: 
'f1   do-events
display is obviously creating the keycodes block (of key face pairs), 
so I've just changed the first character #"t" into 'f1 and it magically 
works.
Graham
3-May-2006
[3560x3]
Hey, that's great.
I remember cloning the feel of the area face so I could process Control 
keys but thought it might be more complicated for a global handler.
So, I can alter the process-keystrokes function to handle the function 
keys in a global fashion.
Anton
3-May-2006
[3563]
Yes.
Ashley
3-May-2006
[3564]
Nice hack Anton, and you've pretty much nailed how the whole thing 
hangs together.


Graham, I used to use F1 (for help) in my apps extensively but I've 
replaced them with buttons / icons recently (bit hard to press F1 
on a TabletPC). For that reason I was never worried about providing 
a "Global Keystrokes" block handler or similiar (apart from the fact 
that you then run into issues like, "I want this keystroke handled 
globally except for these cases ...").
Graham
6-May-2006
[3565x3]
Enhancement request posted to trac: there should be a setting to 
switch the drop down and edit lists to popup rather than drop down 
if there is no space below the widget.
I've got an M200 tablet ... no problems using the F1 key there.
Unless the screen is turned over so that they keys are not accessible 
.. but then no keys are accessible in that case.
Anton
6-May-2006
[3568]
:)
Graham
6-May-2006
[3569]
I'm setting up a preferences screen for users to assign functions 
to the function keys .. no space at the bottom of the screen for 
the drop down lists :(
Ashley
6-May-2006
[3570]
Ideally, and this is similiar to what you stated above, drop/edit 
lists that can't otherwise fit their contents by drop-down should 
then drop-up if the space above the widget is greater than the space 
below. This should be the default behaviour (i.e. display as many 
lines as possible, with a preference for 'below').
Graham
6-May-2006
[3571x2]
Since we define the layout ourselves, we can manually set that at 
definition time, yes?
Another option is to have a list popup that covers the whole of the 
space above and below.