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

World: r3wp

[View] discuss view related issues

Ryan
15-Jan-2005
[235]
and caret-to-offset
eFishAnt
15-Jan-2005
[236]
is that for drag-selecting text?
Ryan
15-Jan-2005
[237x2]
you would use it to implement text dragging possibly. offset-to-caret 
 returns the position of text relative to a graphical position x/y.
i assume you have probably already used highlight-start and highlight-end.
eFishAnt
15-Jan-2005
[239x2]
no, I have just used text-area for stuff like that...now I need to 
change the behavior of it some.
it's a skinny caret on the left side of the area...but thick everywhere 
else.
Ryan
15-Jan-2005
[241x2]
sel-start: does [
	if none? system/view/highlight-start [return none]	

 if (index? system/view/highlight-end) < (index? system/view/highlight-start) 
 [
		return system/view/highlight-end
	] 
	system/view/highlight-start
]
sel-end: does [
	if none? system/view/highlight-end [return none]	

 if (index? system/view/highlight-start) > (index? system/view/highlight-end) 
 [
		return system/view/highlight-start
	] 
	system/view/highlight-end
]
try para [origin: 4x4]
eFishAnt
15-Jan-2005
[243]
understand...but that is there already...origin: 4x4 I mean
Ryan
15-Jan-2005
[244x2]
BTW: The above functions keep sel-start as a lower index position 
than sel-end. These can be either way with highlight
cant replicate the skinny caret. view layout [area]
eFishAnt
15-Jan-2005
[246]
is there some old discussions on this where I can read some discussions?...I 
don't want to hog the channel as I play text area catch up.
Ryan
15-Jan-2005
[247]
Dont know, I figured it out largely by examining the ctx-edit object 
(view editor)
eFishAnt
15-Jan-2005
[248]
ah, cool, I will play with that some.  Aren't you making an editor 
of some type?
Ryan
15-Jan-2005
[249]
A rebol code editor.
eFishAnt
15-Jan-2005
[250]
ah, one that is syntax sensitive, right?
Ryan
15-Jan-2005
[251x3]
I have played with that, but not this one.
it does do some code interpetation, but just for generating a manifest 
for function libraries.
halfway there.
eFishAnt
15-Jan-2005
[254]
cool. Thanks for the ideas, I am going to go back and bang on it 
for the rest of the night...
Ryan
15-Jan-2005
[255]
same here, cya!
Terry
16-Jan-2005
[256]
Is there someway to do this.. 

X: [btn: "test" [print "test"]]

view layout [ X ]
Sunanda
16-Jan-2005
[257]
View layout X should work
(You probably don't want the colon on btn)
Terry
16-Jan-2005
[258]
>> x: [btn "quit"[]]
== [btn "quit" []]
>> view layout [x]
Unknown word or style: x
>>
Sunanda
16-Jan-2005
[259]
view layout x    -- x is already a block/.....No need to put in in 
another one.
Terry
16-Jan-2005
[260]
ok, but how can i form the X code and use it within a layout?
Sunanda
16-Jan-2005
[261]
I tend to dio something like:
 x: copy []
append x 'btn append x "quit"
Compose is useful here too for more complex layout building.
Terry
16-Jan-2005
[262x2]
That still doesnt get my bit of view code into the layout.
unless you're building the layout.. but I'm looking to add a word 
that represents some bit of view code.
Sunanda
16-Jan-2005
[264]
It's trickier if you've already usd layout to convert the dialect 
to VID objects -- then you need to read up on make-face and similar 
functions.
Pre build, just do things like:
x: [button "hi" [print "hello"]]
y: [button "bye" [print "goodbye"]]
z: []
append z y
append z x
view layout z
>>
Graham
16-Jan-2005
[265]
>> x: [ btn "quit" [] ]
== [btn "quit" []]
>> view layout do [ x ]
Terry
16-Jan-2005
[266]
I"m not just doing X, i might do Y and Z as well.
Graham
16-Jan-2005
[267]
but you didn't say that ...
Sunanda
16-Jan-2005
[268]
Terry, you probably need a lot of Composes in that case.

The Vid dialect has ti survive the Do's, so you may need to use more 
lit-words  {'button rather than button)
Terry
16-Jan-2005
[269]
this works

>> x: [quit]
== [quit]
>> view layout [btn x]
Sunanda
16-Jan-2005
[270]
You said you might need to Do it firstL
Try
 x: [quit]
 do x
to see the problem here if you do need to use do first.
Terry
16-Jan-2005
[271]
Hmm, i was just wondering if there is a way to use  'words to represent 
some vid code, be it a button, area... whatever.
Sunanda
16-Jan-2005
[272]
Yes -- but you need to append, compose or mold it to make it the 
right series of characters for Layout to understand.
Volker
16-Jan-2005
[273x2]
depends on what you are doing you can use panel:
 view layout[ panel x panel y .. ]
another way is to use styles. if you want a customized button.
Vincent
16-Jan-2005
[275]
just view layout compose [(x) (y) (z)]
Chris
16-Jan-2005
[276x4]
eFish -- note that Romano has a patch for the ctx-text object: http://www.rebol.it/~romano/#sect2.2.
 You could explore that too...
Terry, I'd suggest either 'compose or 'stylize (or 'stylize/master).
; You could set up a function or two to simplify this code:
my-styles: []
append my-styles stylize [x: btn "Quit" [quit]]
append my-styles stylize [y: btn "Print" [print 'foo]]
view layout [styles my-styles x y]
; For example -- to accumulate styles:
add-styles: func ['val spec /new /local blk][
   blk: [] if new [clear blk]
   append blk stylize head insert spec to-set-word val
]
; Usage:
my-styles: add-styles x [btn "Quit" [quit]]
Gregg
16-Jan-2005
[280]
Here's what I use for simple timers in layouts:

stylize/master [
    timer: sensor 1x1 rate 0:0:1 feel [
        engage: func [face action event] [
            if action = 'time [do-face face none]
        ]
    ]
]
eFishAnt
16-Jan-2005
[281]
aha, Chris thanks!  what I was looking for!
Ryan
16-Jan-2005
[282]
exactly what I needed to complete the undo code for my editor! Thanks 
Chris!
Terry
17-Jan-2005
[283]
Styles are the way to go.  I'm adding °styles° to the °7° system.. 
idea is to have a large collection of panes, buttons, fonts etc... 
all nicely categorized and available at anytime.  If you have some 
styles (or other code), drop it into the °7° group and I'll add it 
to the library.
james_nak
20-Jan-2005
[284]
Hello, I have an app that calls another app with a "do %..." The 
problem is that when I want to exit from the first app after closing 
the second, I am left at a command line as if I called the app from. 
Any one know how to do a double exit?