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

World: r3wp

[View] discuss view related issues

Maxim
24-Jan-2010
[9516]
yes it works, but if you look at the filter box, you will see that 
rebol adds 2 more filters  :-(

who cares about rebol files in an end-user application  >:-(
Gregg
24-Jan-2010
[9517]
I don't remember any tricks to do that Max.
Maxim
24-Jan-2010
[9518]
maybe we should make a wish for it in the next R2 release?
ChristianE
25-Jan-2010
[9519x2]
I see now what the problem is. Those REBOL types are hardcoded into 
view-request sources. 
But you can patch them away with

	remove find/only req-file/filter-list ["*.r" "*.reb" "*.rip"]

 remove skip find req-file/start-out/3 [fp: rty "Normal" "REBOL" "Text" 
 "Images"] 3

After that, request-file should come up without the REBOL types.
That at least seems to work on windows, I don't know what happens 
on other platforms.
Ashley
25-Jan-2010
[9521]
Or just use local-request-file directly.
ChristianE
25-Jan-2010
[9522]
Yes, http://www.mail-archive.com/[rebol-list-:-rebol-:-com]/msg12381.html 
gives some hints on how to do that, but it doesn't seem to be officially 
documented somewhere.
Josh
25-Jan-2010
[9523]
So if an 'area loses focus, the highlighting disappears.  Is that 
correct?
Henrik
25-Jan-2010
[9524]
yes
Josh
25-Jan-2010
[9525]
Is there a way to retain highlighting?
Henrik
25-Jan-2010
[9526x2]
that depends on how you unfocus
In standard VID, it's quite a pain to do anything before the unfocus 
action. You have to manipulate the field and area styles to allow 
an action before that.
Josh
25-Jan-2010
[9528]
I was introducing someone to REBOL, and he made a button that modifies 
the highlighted text.   It works fine with the intialized text, but 
if you type more in the 'area and then press the button, the highlight 
variables are set to none, and I can't figure out why there is a 
difference
Henrik
25-Jan-2010
[9529]
can you show the code? there are som parts of highlighting that can 
be tricky to use.
Josh
25-Jan-2010
[9530x3]
return-highlight: func [fac /a b la lb ans] [
	la: length? a: system/view/highlight-start
	lb: length? b: system/view/highlight-end
	either (la > lb)	[
		ans: replace a b ""				
	] [
		ans: replace b a ""
	]	
	return ans
]
view layout [
	size 600x460
	across
	choice "<w pos>" "N" "ADJ" "V" "PRO" "PREP" [
		t: return-highlight textfield
		before: rejoin [{<w pos="} value {">}]
		after: {</w>}
		textfield/text: rejoin [ before t after ]
		show textfield
	]
	
	below
	textfield: area 575x360 "try me out"
	btn "display selected text" [ 
		alert return-highlight textfield
	]
]
ignore the 'choice.  I should have taken that out
if you highlight some of the text, and press the button, the alert 
works, but if you type in the 'area and press the button, it doesn't
Henrik
25-Jan-2010
[9533x2]
I think part of the problem is that the index is not moving for the 
highlight, when you insert text into the string, so you would have 
to manually move the index for highlight start/end.
and of course when you start typing, there is no highlight anymore.
Josh
25-Jan-2010
[9535]
right, but if you type and then highlight
Henrik
25-Jan-2010
[9536]
if you click and hold the drop down, so that focus isn't lost, does 
it work?
Josh
25-Jan-2010
[9537]
the 'choice isn't what I was focusing on, but if you highlight part 
of the area, then use the choice, and press the button, the alert 
works, but if anything is typed, then highlighted, the system/view/highlight-start 
and end are set to none
Henrik
25-Jan-2010
[9538]
in the choice, you are copying a new string into the textfield. that 
destroys the relation to highlight-start and highlight-end
Josh
25-Jan-2010
[9539]
but what effect does typing have?   I type something, I highlight 
it, I would expect that highlight-start and highlight-end would be 
set when I actually do the action with the mouse
Henrik
25-Jan-2010
[9540x3]
oh! interesting.
sorry, but you are giving me a lot of ideas for the VID Extension 
Kit :-)
but I notice that the field is unfocused, before it crashes. that 
would be why.
Josh
25-Jan-2010
[9543]
how does it get unfocused?
Henrik
25-Jan-2010
[9544]
investigating
Josh
25-Jan-2010
[9545]
That's good! :)  Things need more extension.   I just hope that there 
is a easy enough solution so I don't scare my friend away from REBOL
Henrik
25-Jan-2010
[9546x4]
unfortunately, text editing is deeply broken and too simple in VID. 
I'm hoping to fix this.
ok, try this:

view layout [area button [probe system/view/highlight-start]]

and try typing and highlighting and click the button
it should show the same thing.
I don't have a fix for now, but I'll keep this in mind.
Josh
25-Jan-2010
[9550x3]
when you say the same thing, what do you mean?
The first time (when the console pops up) it is set to none, but 
after that it will work alright
Thanks for looking into it
Henrik
25-Jan-2010
[9553]
when I type and then highlight without changing the focus, and then 
click the button, the field is unfocused and the highlight is none. 
this actually seems like correct behavior, although you would want 
to retain the highlight.
Josh
25-Jan-2010
[9554]
try it more than once
Henrik
25-Jan-2010
[9555]
yes, I did. there is clearly a pattern there.
Maxim
25-Jan-2010
[9556]
I didn't even know about  'local-request-file
Izkata
25-Jan-2010
[9557]
Doesn't work everywhere, though - 2.7.6 on Ubuntu Hardy:
>> local-request-file []
** Script Error: Feature not available in this REBOL
** Near: local-request-file []
WuJian
25-Jan-2010
[9558]
read this link:       http://www.mail-archive.com/[rebol-list-:-rebol-:-com]/msg12381.html
but in my REBOL, 2.7.7.3.1

'local-request-file always returns 'true and 'false,   what does 
this mean.
Ashley
25-Jan-2010
[9559]
local-request-file is only available for Windows and Mac ... and 
the Mac version supports a subset of the functionality available 
on Windows (e.g. no multi-item selection). Two simple examples of 
usuage:

	open-file: make function! [
		/dir path [file!] "Default file name"
	][
		all [ 

   local-request-file path: reduce ["Open" "" clean-path %. either dir 
   [compose [(path)]] [copy []][][] false false]
			join third path first fourth path
		]
	]

	save-file: make function! [
		/dir path [file!] "Default file name"
	][
		all [ 

   local-request-file path: reduce ["Save" "" clean-path %. either dir 
   [compose [(path)]] [copy []][][] false true]
			join third path first fourth path
		]
	]
Rebolek
31-Jan-2010
[9560]
Floyd-Steinberg dithering:
do http://box.lebeda.ws/~rebolek/rebol/dither-fs.r
Not the fastest thing around, I know.
Henrik
31-Jan-2010
[9561x2]
R3? It complains about map!
>> do http://box.lebeda.ws/~rebolek/rebol/dither-fs.r

Script: "Floyd-Steinberg dithering" Version: 0.0.1 Date: 30-Jan-2010

** Script error: invalid argument: [0.0.0 63.63.63 127.127.127 191.191.191 
255.2
55.255]
** Where: make catch either either applier do

** Near: make map! [0.0.0 63.63.63 127.127.127 191.191.191 255.255.25...
Rebolek
31-Jan-2010
[9563x2]
Ah, I'm testing it under 2.7.7
I'll change it to hash! that should be OK then.
Henrik
31-Jan-2010
[9565]
ah, ok. I don't use 2.7.7 as I have a big project that relies on 
2.7.6 and don't want to mess it up.