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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Pekr
6-Oct-2009
[8596]
box red 10x10 on-click [print mold get in face 'feel]

make object! [
    redraw: none
    detect: none
    over: none
    engage: func [face act event][
        case [
            event/double-click [face/action/on-dbl-click face]
            event/type = 'time [face/action/on-time face]
            act = 'up [face/action/on-click face]
            act = 'alt-up [face/action/on-alt-click face]
            act = 'key [
                face/action/on-key face event
                face/action/on-edit face
            ]

            act = 'scroll-line [face/action/on-scroll face event/offset]

            act = 'scroll-page [face/action/on-scroll/page face event/offset]
        ]
    ]
]


Now how to get into the feel, and hook somehow into 'engage method 
:-)
Steeve
6-Oct-2009
[8597]
I never used RebGui, but if you can get the object constructed like 
with VID:
b: box red 10x10 on-click [print face/feel/pos]

then you can patch b with something like:

b/feel: make b/feel [
	pos: 0x0 
	engage: func [f a e] compose [
		pos: e/offset 
		(get in b/feel 'engage) f a e
	]
]


That overloads the engage function wihout losing her actual content.
Ashley
7-Oct-2009
[8598]
In VID you specify the feel directly, in RebGUI you let the widget 
worry about these low-level implementation details. None of the default 
widgets need to pass mouse offsets back to the application, so if 
you need to do this then creating a new widget is the way to go. 
Having said that, I could always add another action handler (on-anything 
face action event) which would fire instead of the above case statement 
(i.e. handle the event as in VID or let RebGUI delegate it to the 
appropriate handler).
Pekr
7-Oct-2009
[8599]
would be nice.
Steeve
7-Oct-2009
[8600]
why not allowing the event as a default parameter for any action 
?

I mean, you only furnish the face as argument, can't you add the 
event too ?
Bobik
8-Oct-2009
[8601]
Steeve it sounds good! FYI:   I needed widget "box" with drag and 
drop features :-) I know it is possible to make new widget atc.. 
So after append-widget was removed, new widget creating is a little 
bit  cumbersom  and i have tried to catch FAE values directly in 
rebgui dialect...:-) I think there are more cases where to catch 
FAE would be useful for app programmer......
Ashley
8-Oct-2009
[8602]
can't you add the event too?

 ... I can, but that breaks a lot of the internal handler code. I'm 
 more interested in seeing what the other FAE cases are (I've yet 
 to hit any myself).
Pekr
14-Oct-2009
[8603]
As append-widget removal was oversimplification imo, especially for 
the widget authors, I created short script, which kind of automates 
the process ....

1) Save the script, e.g. make.r, into the RebGUI root dir

2) create one file, called %my-widget-list.r, containing unnamed 
block, containing file-names. Your widgets can be placed anywhere

3) create backup of %rebgui-widgets.r, call it %rebgui-widgets.old.r, 
in order to be able to easily "remove"  widgets by commenting them 
out in file 2)

Here's the script:
REBOL []

;--- to enable removal of unwanted own widgets, create
;--- copy of rebgui-widgets.r into rebgui-widgets.old.r

;--- remember to do so, when official distro release contains new 
widgets!
if exists? %rebgui-widgets.old.r [
  write %rebgui-widgets.r read %rebgui-widgets.old.r
]

;--- load list of widgets you want to include
;--- file containing un-named block of list of files to include
widgets-to-include: load %my-widget-list.r

template: "^-#include %widgets/^/"

;--- read RebGUI widget list (%rebgui-widgets.r)
tmp: read %rebgui-widgets.r

widget-buffer: copy "^/"

foreach widget-filepath widgets-to-include [ 

   widget: last split-path widget-filepath

   ;--- copy widget to the widget-directory
   write join %widgets/ widget read widget-filepath
  
   ;--- build string containing widget names you want to add ...

   ;--- but only when not already on the list - prevent duplicate entries
   if not found? find tmp widget [

        append widget-buffer (head insert find/tail copy template "/" widget)
   ]

]

;--- append to RebGUI widget-list (%rebgui-widgets.r)
change back back tail tmp (append widget-buffer "]")
write %rebgui-widgets.r tmp

;--- rebuild RebGUI distribution ...
call "create-distribution.r"
Graham
15-Oct-2009
[8604x2]
I'd like to see a generic accordion widget if possible.   So, if 
you had 4 "tabs" in the accordion, then each tab is associated with 
a layout.  If you click on a tab, the others collapse, and the clicked 
on one expands to show the hidden layout underneath.  If you click 
on an open tab, it should collapse .. so that the bottom tab's layout 
is exposed.


I've hard coded this stuff before but was wondering if a generic 
one could be written.
An accordion is like a tab panel but vertical as there is no horizontal 
space.
Ashley
15-Oct-2009
[8606]
Is there a Javascript one I can play around with somewhere?
Graham
15-Oct-2009
[8607]
http://jqueryui.com/demos/accordion/
Graham
16-Oct-2009
[8608]
Here's an accordion I did last night in Rebgui .. hard coded still 
though http://www.youtube.com/watch?v=VYSPNtpNaVU
Pekr
16-Oct-2009
[8609]
That's cool anyway :-)
Graham
16-Oct-2009
[8610x2]
A lot of work doing this manually!
The navigation panel on the left in Altme is an accordion :)
Henrik
19-Oct-2009
[8612]
http://www.dobeash.com/RebGUI/user-guide.html

Typo: bought (search for it)
shadwolf
19-Oct-2009
[8613x2]
event handling management in rebgui ....  that's a topic i wanted 
to discuss 3 or 4 month ago when i tryed to adapt  area-ct to rebgui 
...
ok but with new vid  in R3  what will be the future of rebgui ? ashley 
do you plan to keep rebgui as an enhancement and laboratory ground 
for new kind of widgets design in the new VID ? Or does the new VID 
will kill  rebgui ? What will be the link betwin R3/VID and rebgui 
do you think some of the fun widgets from rebgui will be adapted 
by default in R3/VID ?


If you remmeber i asked this like 1 year ago to carl and didn't get 
any reply...
Claude
21-Oct-2009
[8615x3]
hi, i find a probleme on rebgui-218 bluid with menu widget when i 
select a item !!!!!
here is the message => "result: pick data first picked"   near "on-click" 
         on source rebgui.r  function choose !!!!
picked return []
Ashley
22-Oct-2009
[8618]
re: RebGUI and R3/VID. I'll probably put something up on my website 
on this topic as I get asked this quite a lot. Basic thinking at 
this stage is:

	I need to create SDK GUI apps for Windows and OSX
	R2/RebGUI is the only practical alternative at present for *me*
	I'd love to use R3/VID to create SDK GUI apps today
	This probably won't be possible for quite some time

 If and when this *is* possible I'll port all my apps over to R3/VID

 To do this I'll either create a compatibility layer that lets RebGUI 
 apps run on R3/VID, or

 Write a conversion script that tries to convert (if possible) RebGUI 
 scripts to R3/VID

 I'd hope R3/VID is complete enough that it doesn't require any of 
 RebGUI's basic widgets!
Claude
1-Nov-2009
[8619]
ashley do you have a solution for the menu bug ?
Ashley
2-Nov-2009
[8620]
Yes, but the next build will be a while yet.
Henrik
5-Nov-2009
[8621]
Does the TABLE widget support horizontal scrolling?
Pekr
5-Nov-2009
[8622]
No, there is Cyphre's grid, but it was not adapted to new API changes 
....
Henrik
5-Nov-2009
[8623]
thanks
Graham
22-Nov-2009
[8624x3]
I need to popup a menu where the cursor is.  I guess caret-to-offset 
will get me the offset into the face ....
this doesn't seem to change much in edit-text

caret-to-offset face find/tail/last head view*/caret view*/caret
removingt the /tail seems to help :)
Graham
2-Jan-2010
[8627x2]
how to set the check-group ?


display "" [ cg: check-group data [ "1" none "2" none "3" none ] 
button "Set" [ set-data cg [ true true true ] probe cg/data] ] do-events

doesn't work for me
BTW, set-values.r seems to be missing from the distribution now.
Graham
3-Jan-2010
[8629x2]
I often have the need to set a date on a field ... and use a symbol 
to invoke the request-date .. .but this usually means I have to name 
the date field like this


datefld: field 25 symbol data 'look on-click [ use [d][ if d: request-date 
[ set-text datefld form d ]]]


To avoid naming the datefield, I have this function which returns 
the prior face


get-prior-widget: func [ f
    /local pane priorface
][
    pane: f/parent-face/pane
    priorface: pick pane -1 + index? find pane f
]

and here's a request date that uses it


request-date-priorface: func [ f /local d ]
[
    if d: request-date [
        set-text get-prior-widget f form d
    ]
]

so we can now do:


 field 25 symbol data 'look on-click [  request-date-priorface face 
 ]
Can't use funct as using the SDK :)
Ashley
3-Jan-2010
[8631]
1) set-values.r ... removed in build#212. Plan is to add accessors 
(e.g. add, update, delete) to each "complex" widget.

2) named widgets ... don't forget the 'in-widget function, it does 
what you want above (see biuld#213 release note from Aug 27).

3) funct ... you'll have to build your own collection of SDK+ mezz 
funcs as the SDK diverges further from R3 (and R2 releases without 
an SDK update).
Graham
3-Jan-2010
[8632x3]
and how to set  a check-group?
Just looked at in-widget, and it does different things. I want to 
find a specific widget ...
And this doesn't seem to work either


>> display "" [ gb: group-box -1x-1 data [ t: table "test" options 
[ "a" left 1 ] data [ 1 2 3 ]] return button "Get" [ probe get-values 
gb ]] do-events
[[]]
Graham
4-Jan-2010
[8635x3]
Ashley, I posted a simple function that grabs spelling suggestions 
from the google spell checker.  I  am going to see if I can use it 
in the rebgui spell checker to provide suggestions as currently the 
spell checker does not ....
posted in the core group
I've managed to incorporate the google spell check into rebgui's 
spell checker... but it is slower of course but more accurate.

Some optimizations would be to add correctly spelled words unknown 
to the local dictionary automatically, and to also spell check a 
number of words at the same time ... it probably makes not much difference 
to the google spell checker, and is less expensive in terms of web 
calls.
Graham
5-Jan-2010
[8638x2]
What I am doing now .. is scanning all the words in the face, and 
checking them against the dictionary.  If not found, I collect them 
all and then submit all of them to google.  This then gives me lists 
of choices for each word which is not recognized.
Seems to be working ...
Pekr
5-Jan-2010
[8640]
In RebDOC, Request-font throws an error ...
Graham
5-Jan-2010
[8641]
4.  I can't see a way to update the check-group so looks like it 
is easier for me to just  rebuild the check-group on the fly
jack-ort
24-Feb-2010
[8642]
Hi!  maybe I should ask this in the "I'm New" group.  Wanted to try 
out RebGUI for my 2nd REBOL project.  I'm stuck early on trying to 
refresh a table based on a SQL query in a parent window when closing 
a child window that would have added a record to table.  I've gotten 
the examples on click and away events to work, but do not understand 
how to use focus events apparently.  Can someone point me to some 
sample code that would help w/ moving focus from window to window 
and refreshing tables?  With that, I think most of my GUI problems 
would be solved. 

TIA!  -Jack
Graham
24-Feb-2010
[8643]
Post some sample code somewhere ...
Ashley
25-Feb-2010
[8644]
http://www.dobeash.com/RebGUI/cookbook.html#section-1might help 
you get started.
jack-ort
25-Feb-2010
[8645]
Ashley - that got me started, but where I get stuck is on the syntax 
to refer to a widget *in another window*.  In the sample below, I 
want my "Save" button to not only write a new record to my SQLite 
db, but also to refresh the query that loads the table in the parent 
window (OR, can I refresh the parent window table after the child 
window closes and the focus returns to the parent?  I cannot seem 
to trigger any focus events.).  I was trying to wrap my windows in 
objects, which are new to me also, so I'm sure that is part of my 
problem.  Obviously my attempt to refer to my table by this path 
(adddelusers/gui/tbl/data) is incorrect, since I get this error:

** Script Error: Invalid path value: tbl
** Where: on-click

** Near: insert adddelusers/gui/tbl/data (sql/flat "select * from 
users order by userid") adddelusers/gui/tbl/redraw

adddelusers: context [
			title: {Add/Remove Users}

   tbldata: copy esql/rtn [sql/flat "select * from users order by userid"][]
			gui: [

    tbl: table 125x50 options ["UserID" left 0.2 "Password" left 0.8] 
				return
				button "Add User" 30 on [
										click [display/parent adduser/title adduser/gui ]
									]
				button "Remove User" 30 [alert "need to add code here..."]
						]	
]

adduser: context [
		title: {Add User}
		gui: [	
				user:	field text "username" return
				pwd:	field text "password" return

    button "Save" [sql compose ["insert or replace into users values 
    (?,?)" (to-word user/text) (to-binary checksum/secure pwd/text)]

         insert adddelusers/gui/tbl/data (sql/flat "select * from users order 
         by userid") adddelusers/gui/tbl/redraw
								unview adduser/gui ]
				button "Cancel" [unview adduser/gui]
		]
	]