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

World: r3wp

[View] discuss view related issues

Maxim
2-Feb-2007
[6664x2]
I remember having a hell of time trying to resize the window properly 
without it causing a cascade of resize/show events...
(where talking a few years ago so my memory is rusty)
Anton
3-Feb-2007
[6666x8]
Ok, here's an issue that's just come up for me:
view layout [field [print "validate 1"] field [print "validate 2"]]
If you type in a field, then press TAB it prints "validate" - Good.

if you type in a field, then press SHIFT-TAB, it does not. - Bad. 
<----
This behaviour is specified in the EDIT-TEXT function in CTX-TEXT, 
in the TAB-CHAR handler.

I seem to recall someone actually asking for this behaviour. I think 
they wanted a way to "reverse out" of a field without validating 
it.

This seems wrong to me. I would have thought Shift-TAB would be just 
like TAB, except going in the opposite direction. I want to always 
validate when leaving the field.

It would be better if undo was implemented for the field. When all 
the changes are undone, then the face/dirty? field should be reset 
and the face/action can avoid validating unnecessarily.

The ESCAPE key could be used to undo all changes (and so avoid validating) 
before the user TABs or SHIFT-TABs out of there.
ie. I don't want to leave a field with unvalidated data in it.

I have a decimal-field, which is just a field whose action just cleans 
the face/text and ensures that it can be converted to a decimal.
If the user can just SHIFT-TAB after making changes to the field 
then the validation in the action block is skipped and the field 
is left showing invalid data.
The line in the TAB-CHAR handler in EDIT-TEXT which is causing all 
the trouble is this one:
	if not event/shift [action face face/data]

This line is gonna get the knife, if I have anything to do with it.
So I might make a RAMBO bug report on that.
Anyone have any comments before I do ?
Gabriele
3-Feb-2007
[6674x2]
this is a difficult issue. personally, i prefer tab and shift-tab 
to not do any validation, while enter does. it's not always a good 
idea to not let users go away from a field just because it is invalid.
however, since this depends on the application etc., i think the 
best solution is to call the action on enter, and just call face/refocus 
on tab / shift-tab. then you can make refocus do the same as the 
action, or not.
Pekr
3-Feb-2007
[6676]
Gabriele - will there be anything improved in regards to keyboard 
and R3? Key-up event, ctrl tab, multiple keys pressed?
Gabriele
3-Feb-2007
[6677]
there are no details on this currently. but, this part should be 
in the open source part, so as long as people can manage to let it 
work consistently across platforms, i'm sure it can be done.
Henrik
3-Feb-2007
[6678]
Anton, gabriele, thanks alot for those tips! Maxim also told me that 
the feel must be set every time you view the window.
Gabriele
3-Feb-2007
[6679x3]
yes, view can change win/feel
i think that the latest versions don't, but there may still be cases 
where that happens.
to be safe, you can view/new, change feel, then do-events.
Anton
3-Feb-2007
[6682x3]
Gabriele, I see your point: The user might want to enter some data 
in a field, but part way through think of something else and leave 
the field to attend to it, then return to the original field to complete 
the data entry. Finally the enter key will do the face action which 
can validate the field.
I think your solution using REFOCUS is a good one.
Henrik, welcome. Just look in source of VIEW to see how it sets the 
window feel. Gabriele is right, nowadays it shouldn't cause much 
trouble.
Pekr
3-Feb-2007
[6685]
Are we still going with 'feel like it exists today, even for R3?
Henrik
3-Feb-2007
[6686]
I hope it will allow more granular events.
Pekr
3-Feb-2007
[6687x2]
I hope too. I don't like mega monstrose 'feel. It does not scale 
well. On one hand, you can code everything from one place, on the 
other hand, it is more handy for "style authors", than end-users 
...
Ah, but maybe by "more granular" you meant receiving events more 
often?
Henrik
3-Feb-2007
[6689x2]
No, more different kinds of events.
I think personally that FEEL is very non-accessible to users and 
non-extensible. You can't easily add a simple thing to a feel, like 
when you create a style from a specific face. If you want single-key 
actions from a text field, you have to dive into the feel code, study 
it, know how feel and events work and then add your code. This is 
probably more an issue with the feel code itself, rather than the 
concept of FEEL.
Pekr
3-Feb-2007
[6691]
Ah, then we are on the same wave. But I was not able to defend my 
opinion to e.g. Anton in the past :-) So surely rebollers will differ. 
For your own kind of style, e.g. animation, you might prefer current 
aproach. But I visited recently my friend, who started to learn Delphi 
some 2 months ago, and he already did nice app in it. The most missed 
feature of SDK is - no screen painter, lack of crucial styles, lack 
of proper style behavior (just try list-down here in AltME, you can't 
close it by clicking outside, esc, etc.?), and most ppl are really 
used to - on-double-click, on-left-click, on-over, whatever ...
Henrik
3-Feb-2007
[6692]
There should be a ton of placeholders inside the feel code, to let 
you easily set those placeholders from within layout. I know this 
is possible to do.


view layout [field 100 single-key-action [print face/key]] or something
Pekr
3-Feb-2007
[6693x2]
maybe: feel [
ah, enter ;-)
Henrik
3-Feb-2007
[6695]
LIST-VIEW has a lot of different actions that let you set what it 
should do in particular situations easily. Every single VID element 
should have that. In fact there should be an abundance of placeholders 
for actions, every one that we can think of.
Pekr
3-Feb-2007
[6696]
feel: [
on-single-key            [block of code]
on-left-mouse-click [block of code]
on-double-click        [block of code]
]
Henrik
3-Feb-2007
[6697]
yes, very simple.
Pekr
3-Feb-2007
[6698]
What I just don't know - what if you would like to serve e.g. holding 
down shift key and holding down left mouse button? e.g. for dragging 
something? I mean - you need both functionalities of on-something 
- how do you mix code then in those code-blocks?
Anton
3-Feb-2007
[6699x2]
So to use REFOCUS:
view layout [
	field
	field with [
		refocus: func [shift /local new-field][

               new-field: either shift [ctx-text/back-field self][ctx-text/next-field 
               self] 
               action self data
               focus new-field
		]
	][
		; action
		print "validate" ?? value
	]
	field
]
Pekr
3-Feb-2007
[6701]
That system would be even inspectable, extensible dynamically, not 
like current 'feel, whish is "just rebol code"
Henrik
3-Feb-2007
[6702]
Pekr, then they would work as flags. You should be able to access 
from within the code block, which qualifier keys are pressed. Binding 
the code automatically to the feel object would let you access the 
variables and events in the feel object.
Pekr
3-Feb-2007
[6703x2]
yes, setting flags .... nice ...
I would even simplify low-level View aproach - no native redraw, 
over - it could be part of one feel, no?
Anton
3-Feb-2007
[6705x2]
Current feel objects can be inspected and extended dynamically.
I think the feeling is to have more higher level types of events 
derived from the raw event stream and provided to you in a more separate 
kind of fashion.
Pekr
3-Feb-2007
[6707x2]
imo our aproach is non-intuitive, non-traditional. Feel is definitely 
not granular enough to be familiar to newcomers, who are used to 
on-something.
... maybe that is what we are talking about?
Anton
3-Feb-2007
[6709x2]
But if this is done for every face, would this not slow down the 
event system ? (Maybe it would, maybe it wouldn't, significantly, 
I'm not sure.)
As far as I see it, RT uses objects when speed is needed. They can 
map down to C structures better I think.
Henrik
3-Feb-2007
[6711]
I don't think it's noticable. Every time I've done optimizations 
on events, removing redraws are causing the biggest slow downs. Everything 
else is hardly noticable.
Anton
3-Feb-2007
[6712]
Maybe we can make a dialect which maps the simple representation 
you've suggested above into an actual working FEEL.
Pekr
3-Feb-2007
[6713]
yes, I start to like the aproach - one 'feel, like today, but dialect 
abstraction ....