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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

Sunanda
20-Jan-2008
[1139]
Thanks Gabriele -- that may work for SteveT.

However, there are some anomalies in the way parse handles RFC4180 
formatted CSV files. Particularly if there are embedded double quotes 
in a field.


For my purposes, I find tab delimited files are better -- though 
still not always perfect:

    >> x: parse/all {"a"^- ","","} to-string tab

    == ["a" { ","","}]   ;; 2nd field should be {,",}  -- result is close 
    enough that it can be tidied into that
 
   >> y: parse/all {"a", ","","} ","
    == ["a" { "} "" ""]    ;; 2nd field mashed irrecoverable!
Gabriele
21-Jan-2008
[1140]
the best solution is always to create your own rule, that fits your 
source files perfectly. the built in one helps in simple cases, but 
gets in the way more often than not (imho). it's handy for new users 
though, because they can parse cvs right away, and worry about the 
details only later on when they've learnt parse better :)
SteveT
21-Jan-2008
[1141x2]
Hi Gabriele, that's a good point, I've read the above articles about 
parse and there's an awful lot to learn to use it effectivly in REBOL.
Hi Henrik, yes I know it can be done and you can create your own 
styles or extensions, but new 'Winows' programmers will be very put 
off by that. they shouldn't have to override the VID to do expected 
things liek I mentioned.
Henrik
21-Jan-2008
[1143]
exactly. this problem will go away in VID3 for R3. VID is very sparse 
with features like this and you've hit that wall now, a wall I've 
been climbing for years by doing things like LIST-VIEW and vid-field.r. 
:-)
SteveT
21-Jan-2008
[1144]
;-)
Henrik
21-Jan-2008
[1145]
a problem is that a lot of these internals are not documented and 
so they are very hard to figure out. I think it's safe to say this 
is the biggest sore point about REBOL, one we're anxious to not only 
fix but to turn completely around on and become a leader with.
SteveT
21-Jan-2008
[1146]
I know some of my old colleagues would have a tick list before they 
would attempt any language/system and i think VID fails badly there. 
I can cope with it cos I'm so into Rebol, but I know others would 
find say Python with vxWidgets would tick more of their boxes!  Sorry 
for swearing (Python) ;-)
Henrik
21-Jan-2008
[1147]
your points are perfectly valid :-)
SteveT
21-Jan-2008
[1148x2]
BTW Henrik - when do you sleep ?
i thought I was bad!
Henrik
21-Jan-2008
[1150x2]
I'm usually a night owl. I went to bed at 3 am and I got up at 11 
am.
which is almost an hour ago here
SteveT
21-Jan-2008
[1152]
You in Denmark ??
Henrik
21-Jan-2008
[1153]
yes
SteveT
21-Jan-2008
[1154]
Are a lot of the other guys in the US? It's interesting to see where 
were all spread - hink Ashley is anitpadean Tes?
Henrik
21-Jan-2008
[1155]
I think we're mostly US and European, but we have a few easterners 
as well.
SteveT
21-Jan-2008
[1156x3]
Cool, is Ashley re-working rebGUI for VID 3 or will it be redundant. 
I've never bean totally happy with a third party widgets (like Python 
+ vxWidgets) or Java + Mattisse etc
The accessors to the widgets need to be developed by the language 
developers normally IMO
I had a go with Ruby and vxWidgerts - it really put me off
Henrik
21-Jan-2008
[1159]
I'm not sure RebGUI will be available for R3, but he knows that better 
than me. I've never used RebGUI much. :-)
SteveT
21-Jan-2008
[1160x2]
No I've downloaded it but put it to one-side, too much to learn at 
the moment.
Can a style include events?
Henrik
21-Jan-2008
[1162]
yes, you can manipulate the events for a style with the FEEL object.
SteveT
21-Jan-2008
[1163]
Right so I could create  styles to override the field and include 
params for number of chars to allow or convert to upper and perhaps 
use parse to restrict to numbers ?
Anton
21-Jan-2008
[1164]
Yes, you can trap and handle in your own way all of the events a 
field style can receive.
SteveT
21-Jan-2008
[1165]
Thanks Henrik , I'll have a go with that today.
Anton
21-Jan-2008
[1166x2]
print mold svv/vid-styles/field/feel

You can see the engage function is where most of the event handling 
is.
You can redefine the engage yourself like this:
layout [
	style my-field field feel [
		engage: func [face action event][
			..
		]
	]
]
Henrik
21-Jan-2008
[1168x2]
that's basically what vid-field.r does. it takes the existing FIELD 
style and changes its FEEL object to contain more options for better 
text handling.
Anton's made a version that has undo/redo, right?
Anton
21-Jan-2008
[1170x3]
You can copy the code from the default engage function, but you will 
fall into a trap; some of the words used in the default engage handler 
are bound to specific contexts. Your code will bind all the words 
in your context or global context. I'm talking about the words focal-face 
(which is in system/view), unlight-text, highlight-start, highlight-end 
and edit-text (which are in ctx-text).
So you should bind your code first to system/view, then to ctx-text, 
before making the function:
style my-field field feel [
	engage: func [face action event] bind bind [

		; your code which uses focal-face, unlight-text etc...

	] system/view ctx-text
]
SteveT
21-Jan-2008
[1173]
Ok, just found some mention of ctx-text in the docs.
Anton
21-Jan-2008
[1174]
Henrik, unlimited undo/redo.
Henrik
21-Jan-2008
[1175]
probably a good idea to learn about bindings first to know what it 
means :-)
Anton
21-Jan-2008
[1176x2]
My edit-panel style is actually based on PANEL style, but pretty 
much supplants AREA, if you're happy with monospace font. (I haven't 
supported a single-line FIELD-like style, but could be easily done 
I expect.)
See the Editors group to try out the edit-panel style.
SteveT
21-Jan-2008
[1178]
One other funcionality I'm missing is to be able to set the tab order 
! They won't always be the presented order.
And wether CR should act a sTAB or not.
Anton
21-Jan-2008
[1179x2]
Aha... the built-in tab-cycling system is simplistic. I made my own 
but it still goes in pane order.
whether CR can act as tab can be determined with a face flag.
SteveT
21-Jan-2008
[1181]
Ok thanks, Tab order might be cobbled by enlosing field in two or 
more vertical panels. Sorry missed the flag for CR.
Anton
21-Jan-2008
[1182x2]
layout [f: field] probe f/flags ; == [field return tabbed on-unfocus 
input]
view layout [f: field with [deflag-face self return]]
AREA does not have the 'return flag.
probe svv/vid-styles/area/flags ; == [tabbed on-unfocus input]
SteveT
21-Jan-2008
[1184]
whats svv ?
Anton
21-Jan-2008
[1185x3]
You could also handle key events and trap the tab key, directing 
the focus to any face you like.
system/view/vid
A very handy shortcut.
SteveT
21-Jan-2008
[1188]
ah thanks