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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Normand
1-Jul-2006
[4281]
I want to add some commands to the top window red "close" square 
button, so that I commit changes to the database and save some data 
before the close.  I can add a quit button on the interface, but 
it is still important that the top window close button do the same 
thing.  I dont see any instructions about that, neither in the RebGui 
display guide, nor the vid spec.  Can someone provide the code to 
do that, or where to find it explicitly?
Volker
1-Jul-2006
[4282]
quit-wenn-close: func [face event] [
    if 'close = event/type [quit] 
    event
] 
insert-event-func :quit-wenn-close
Henrik
1-Jul-2006
[4283x2]
remember that insert-event-func inserts the event in a block of events 
so if you run the same program multiple times from console, the event 
will be added again the next time you run it and therefore run twice.
block of events should be block of functions
Graham
1-Jul-2006
[4285]
there's an option in display to capture the close event.
Normand
4-Jul-2006
[4286x2]
A so smart pill marketer created false defect on the timeline http://trac.geekisp.com/rebgui/timeline.
I am unable to refresh a textlist.  My text list is defined as

Fall-ids: text-list 80x60 #HW data (db-select uniqueid contactDB) 
[
			new-cursor: rowid-of-identifier? face/selected
			valid-set: validate-cursor new-cursor
			if valid-set [show-values-of-current-cursor]
			]
And my function to refresh it is :
refresh-ids-list: does [
	Fall-ids/data: (db-select uniqueid contactDB)
	Fall-ids/redraw
]

Calling this, the data gets changed, but the textlist does not redraws 
itself?  I did try with set in Fall-dis 'data and show Fall-ids, 
without effect either. 3 hours later I am still in neverland.  Any 
Ideas?.
Graham
4-Jul-2006
[4288x2]
this won't work
try


refresh-ids-list: does [ insert clear head fall-ids/data db-select 
uniqueid contact db fall-ids/redraw ]
Normand
4-Jul-2006
[4290]
Thank-you, it works.  It is not clear in my head, as to why 'insert 
clear' is better than 'TheObject/Data: "NewListOfValues"', but Ill 
try to remember it by hart.  I am nearing completion of a small example 
of RebGui+RebDB app.  Last glitches are show-focus and display/close.

As for the option in display to capture the close event, how do I 
state it?  As this does not work.
Contact: compose/deep/only [
; Gui definition
]
do show-contact: does [
	display/min-size "ContactDB" Contact 680x650
	do[show-first-rowid]
	display/close [] [shutdown] ; <-- Culprit
	]
do-events
Graham
5-Jul-2006
[4291]
I presume that the internal functions already have referenced the 
/data so, when you reset it using data: ( .. ), they can't find the 
data anymore.
[unknown: 10]
5-Jul-2006
[4292x2]
Funny to see the Memory Usage in Rebgui, Under linux it eats almost 
2 MB during startup under WinXP its 1 MB less...
Never the less, a very nice result guys !!! Ill use it ;-)
Graham
6-Jul-2006
[4294x2]
How do tabs work in area fields?
this doesn't work { area with [flags: [field]] }
There is very odd behaviour of tab in in tour.r in the area
Ashley
6-Jul-2006
[4296]
Tab (and shift-tab) changes focus. 'with is a VID construct, not 
RebGUI (unless Cyphre's changes are more far reaching than I'm aware 
of ;) )


The area in tour.r is the only tabable widget so it re-tabs to end 
of text. Try:

	display "" [area area area]


to see how it works when more than one tabable widget is/are present.
Graham
6-Jul-2006
[4297x2]
how to tab inside an area??
Seems this is an enhancement that needs to be done.
Robert
6-Jul-2006
[4299]
Just tab through all fields. Area will be entered as well.
Graham
6-Jul-2006
[4300]
Robert, I want to stay inside the area
Ashley
6-Jul-2006
[4301]
No reason why it can't be supported as the following shows:

display "" [
	a: area
	button [insert tail a/text tab]
]

but which widgets should support it? area? text? others?


If Tab is redefined for these widgets then how does one navigate 
to other widgets apart from mouse clicks? Or should we have a special 
key combination for "hard-tabs"?
Graham
6-Jul-2006
[4302x2]
Just area I think.
or have an option like it is done in VID
Robert
7-Jul-2006
[4304]
Maybe it's best to support SHIFT-TAB as TAB inside an area. Using 
TAB to navigate between fields is very common to a lot of users. 
And in other programs (like Excel) you have to use ALT-RETURN to 
insert a hard line break in a cell. Just RETURN leaves the cell.
Ashley
7-Jul-2006
[4305]
Shift-Tab is already mapped to Backtab. How about Ctrl-Tab instead?
Robert
7-Jul-2006
[4306]
Ok
Anton
7-Jul-2006
[4307]
I don't think you can trap ctrl-tab.
Robert
7-Jul-2006
[4308]
ALT-TAB?
Graham
7-Jul-2006
[4309x2]
make it optional...
I spend most of my time inside area fields ...
Ashley
7-Jul-2006
[4311x2]
Graham, that caret insert question you had before can be easily solved 
with something like:

display "" [
	a: area "12345"
	button [
		all [
			system/view/caret
			insert at a/text index? system/view/caret "-"
			show a
		]
	]
]


More complex variations (to handle keyboard focus change, multiple 
area targets etc) can be built with code like:

	...
	area on-unfocus [i: index? system/view/caret true]
	...


but the first example handles simple "click within area, click on 
button" type scenarios pretty well as is.
Also committed rev#26 with support for Ctrl-Enter hard tabs, and 
removed references to drop-tree/number-field so create-distribution 
works correctly.
Graham
8-Jul-2006
[4313x2]
Thanks Ashley, I'll give that a go.
Hmm. Your demo works, but in my program, it always inserts at the 
head of the area field ie. index? system/view/caret is 1
Anton
8-Jul-2006
[4315x2]
You should check if the caret is in your area/text :
button [all [
	same? head system/view/caret head a/text
	insert ...
Oh no, sorry I misunderstood. Once the caret has left the area and 
moved to another widget the index it was at is completely lost. You 
would need to store the index on each key press, or trap the loss 
of focus and store the index then. Pressing the button would refer 
to that stored index.
Volker
8-Jul-2006
[4317]
as in http://polly.rebol.it/test/test/rebgui/../../test/rebgui/edit-area.r
Graham
9-Jul-2006
[4318x4]
** Internal Error: Stack overflow
** Where: into-widget
** Near: unless find [object! block!] type?/word get
** Press enter to quit...

Got this error again on tabbing out of a field :(
display "0" [
	button "Click me" [
		display "1" compose/deep [
			f: field "Type here" [
				display "2" [
					button "Close" [show-text f "hello" show-focus g unview]
				]
			]
			return
			label "I can tab to here but can I type?" g: field ""
		]
	]
]
do-events
click on the button, and then type in the first field, enter,  click 
the button.

you can now tab between the two fields but can not type as the window 
"0" has focus.
Odd ....
Is Rebgui not tracking the windows correctly? Or something?
Volker
9-Jul-2006
[4322]
Could be that after a button-action the focus is removed, so show-focus 
does nothing.
Graham
9-Jul-2006
[4323x2]
Except I do have some type of focus as the tab still works correctly.
Just can't type.  And the window is not highlighted as though it 
does not have focus.
Volker
9-Jul-2006
[4325]
Hmm. how about activating it first?
Graham
9-Jul-2006
[4326]
how?
Volker
9-Jul-2006
[4327x4]
IIRC, basically: win/changes: 'activate show win
but does not help on linux
display "0" [
    button "Click me" [
        display "1" compose/deep [
            f: field "Type here" [
                display "2" [
                    button "Close" [
                        show-text f "hello" 
                        show-focus g unview 
                        win: find-window g 
                        g/changes: 'activate 
                        show win
                    ]
                ]
            ] 
            return 
            label "I can tab to here but can I type?" g: field ""
        ]
    ]
]
win/changes: 'activate;but still nothing