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

World: r3wp

[View] discuss view related issues

Ingo
13-Jun-2007
[7039]
... but my modifications didn't do automatic index.r either ...
amacleod
28-Jun-2007
[7040]
I making an app that requires a long pick list that will be contained 
in one of cyphre's tab panels that will be relativly narrow. ..so 
"Choice" will not work as the face is not large enough. I've tried 
rebol's drop-down but I can not see the whole widget. Are there refinements 
to this "widget" I can not find any docs on it. I have tried to use 
'Cyphre's drop-down but I am also using the list-view widget and 
htere sems to be some kind of conflict. I have also tried drop-down.r 
from hte library and it displays fine but I can not upate it to display 
waht I select in the list-view widget. Any thoughts?
Anton
29-Jun-2007
[7041x4]
Maybe this will help. 
http://anton.wildit.net.au/rebol/gui/demo-drop-down.r

But it sounds like the small size of the parent face (the tab panel) 
will clip the drop-down.

Actually yes, I think what you want to do is modify this function, 
so that the width of the drop-down list (which is a popup window) 
is not determined by the width of the drop-down face which popped 
it.
	print mold get in svv/vid-styles/drop-down 'show-dropdown
Here's a demo where the list width (300) is twice the width of the 
drop-down face (150):
my-data: ["hello" "there" "everyone" "have" "fun"]

view layout [
	size 400x400
	drop-down data my-data [hide-popup] 150 with [
		append init [

   change select select select second :show-dropdown [if not list-lay][list-lay: 
   layout][to-pair reduce] 300
		]
	]
]
There will be a bit of trouble if you want to make that 300 a function 
of the face/size or something like that. You might have to bind the 
code so that 'face is taken from the right context. Let us know.
amacleod
29-Jun-2007
[7045]
Thanks for the demo script. I did not know ther was that much control 
with the stock rebol drop-down. It did not solve my problem with 
the display of hte full widget. I said the tab-panel was narrow ...I 
ment short. But the other problem seems to be that "tab Panel" seems 
to cut the wiget unless there is soething else occupying the space 
below.  At first I solved it by adding a series of empty text and 
returns but now I fill it with a box and place the drop-down with 
the at statement. Thanks!
Anton
29-Jun-2007
[7046x2]
Ah, you mean the tab panel does not allow enough space for its contents, 
in this case, the drop-down ?
How are you populating the tab-panel ? This sounds like it should 
be an easier problem, because that's a common requirement.
TimW
3-Jul-2007
[7048]
May be a lame question, but the no-border options doesn't seem to 
work in linux.  Any ideas?
btiffin
3-Jul-2007
[7049]
TimW;  No lame questions.  Can't help though.  no-border doesn't 
take for all the versions of REBOL/View I run on Debian.  Even tried 
poking around with main layout options... no go.  In short no idea.
Ashley
3-Jul-2007
[7050]
From http://www.rebol.com/docs/view-system.html#section-4.5

Window System Dependent


The no-title and other options depend to some degree on the windowing 
system being used. They may not work in an identical fashion on all 
operating/windowing systems.
amacleod
3-Jul-2007
[7051]
Anton, I'm populating it with some text fields, and a few drop-downs. 
If the drop-down is too close to  the bottom of the panel it will 
not display below and outside the panel even though the app window 
goes a bit lower. As I said before, if there is nothing else in hte 
tab panel except for the drop-down, the drop down gets cut off even 
if there is plenty of room below within hte tab panel. I need to 
fill it withsomething. My solution is a box of the same size as the 
panel but then I need to use "at" for all my other elemnts to place 
themk properly.
Ashley
5-Jul-2007
[7052]
Anyone come up with a nifty way to get the size of vectorial text? 
Something like size-text:

	size-svg-text draw 1000x1000 [text vectorial "Hi"]
Ashley
6-Jul-2007
[7053]
QAD first cut:


size-svg-text: make function! [text [string!] font [object!] /local 
img size i] [

 img: draw size: 200x200 compose [font (font) text vectorial (text)]
	;	determine y
	i: length? img
	while [zero? img/:i] [i: i - 1]
	size/y: i / size/y + 1
	;	determine x
	i: mod i size/x				; x offset of last match
	repeat y size/y [			; scan each line

  repeat x size/x - i [	; start each line scan at point of last match
			unless zero? pick img (y - 1 * size/y) + i + x [
				i: i + x
			]
		]
	]
	size/x: i
	size
]

size-svg-text "Hello World!" make face/font [size: 24]
Anton
6-Jul-2007
[7054]
Ashley, it depends what you want to do.

If you aren't going to transform the text in crazy ways (or maybe 
even if you are), then I would create a "sizing-face" with the same 
text and font, then use just size-text on it. It's going to be faster 
than scanning every pixel.
Henrik
6-Jul-2007
[7055]
kerning is not identical for View text and DRAW text, so you can 
only approximate the size.
Anton
6-Jul-2007
[7056x3]
Yes, there are limitations.
But, you can be pretty precise if you don't use all parameters of 
para object (and font object ?)
Oh hang on, we're talking vectorial text. I don't think I've experimented 
much with that.
Pekr
8-Jul-2007
[7059]
How do I do following?

copy-screen: center-face layout [screen code here]


forever [ if new disk is found .... start screen, call copy routine]


And now I have a problem - if I do view copy-screen, call of copy 
routine is not performed. So I tried to put the copy routine into 
do [call copy routine] into the layout code, but those variables 
are not known yet ...


I would like to have some "delayed" run of 'do section. (view/new 
and do-events is not possible, as my copy routine is recursive and 
do-events would be callled multiple-times. Is there any trick? Timer 
probably? Well, but trouble is, that script sits in the background, 
and copy screen should apper only if new disk with appropriate content 
is found, then it should disapper and go to wait mode into background 
....
Graham
8-Jul-2007
[7060]
poll
Pekr
8-Jul-2007
[7061]
how?
Graham
8-Jul-2007
[7062]
open the gui only when you detect a disk present
Pekr
8-Jul-2007
[7063x3]
simply put I need following - 1) define layout 2) run main loop. 
If device detected, start screen 3) call copy function from the screen 
4) unview screen, back to main loop
I do that ...
where should I call my copy-dir function from?
Graham
8-Jul-2007
[7066x2]
your main routine
not the gui
Pekr
8-Jul-2007
[7068]
if I put it into parens or 'do block into VID, it gets called during 
layout phase ...
Graham
8-Jul-2007
[7069]
why does it have to be in vid??
Pekr
8-Jul-2007
[7070x3]
OK, so I do:

forever [
   if disk is detected [
        view/new copy-screen
        copy-dir source target
]

Now where do I put do-events?
'copy-dir is recursive, I can't start event loop there ..... I need 
to somehow start function from the copy-screen section. It is just 
that I don't want to have it assigned to button :-)
I remember that we did some timer trick in the past, but can't remember 
now ....
Graham
8-Jul-2007
[7073]
view/new copy-screen
hide copy-screen

forever [ if screen detected [ show copy-screen do-stuff hide copy-sceen 
]]
Pekr
8-Jul-2007
[7074]
so no do-events?
Graham
8-Jul-2007
[7075x4]
somewhere :)
run it in the task bar
and when you detect the disk, then bring up the main gui
I mean system tray
Pekr
8-Jul-2007
[7079]
Graham - I used one trick, I defined new style in VID, called init, 
set rate to 1and defined engage block. After first call, I removed 
timer, but it worked in a bit weird way. In my copy routine I used 
little wait, but it did not work properly ...
btiffin
8-Jul-2007
[7080]
Pekr;  did you show the face after changing the rate?  I got caught 
up by that one recently, the timer fires at old rate until show was 
called.  It is documented, but who reads those.  :)
Pekr
8-Jul-2007
[7081]
yes, I used show ...
btiffin
8-Jul-2007
[7082]
Thought so...wanted to mention it...just in case.
Pekr
8-Jul-2007
[7083x2]
but it is possible my code could be messed-up ....
I really miss delayed after-init method in VID. 'do nor parens can 
make it, as those are executed during layout evaluation, not after 
'view is called ...
Gabriele
8-Jul-2007
[7085x2]
petr, while you are busy copying, you are not handling events, so 
no do-events there. you can call wait 0 every iteration if you want 
to respond to events while copying.
delayed after init is the same as doing something AFTER view/new
btiffin
8-Jul-2007
[7087]
And just think...everything is about to change and we get a whole 
new can of worms to dig through.  The one comment Carl made about 
'hard-won knowledge' has me a litlle, umm, exitedly anxious for the 
docs.
Gabriele
8-Jul-2007
[7088]
hmm, don't see much change in a case like this, you still do the 
layout, view/no-wait it (new ref name instead of /new), and do the 
copy. maybe, you'll want to copy in a bg task, but that's another 
story.