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

World: r3wp

[View] discuss view related issues

Gabriele
8-Jul-2007
[7094]
even if you call copy-dir from engage, events are not processed while 
inside copy-dir unless you call wait
Pekr
8-Jul-2007
[7095]
ah, so wait 0 causes processing of events?
Gabriele
9-Jul-2007
[7096]
those that are pending, yes. you can wait a little more to allow 
more to be processed, if you don't care about slowing down your copy.
amacleod
9-Jul-2007
[7097]
How are you detecting the the disk being inserted. Are you accessing 
the os. Also, would this work for flash disks?
Pekr
9-Jul-2007
[7098x3]
yes, it works ...
it is very simple principle ... well, it is not even a detection. 
When my script runs in the background, it does:

root: %/
drives: read root

later on, I simply check:

forever [
  wait interval
    foreach disk difference read root drives [
    ]
]
... and difference on block will throw you new disk ....
amacleod
9-Jul-2007
[7101]
That seems simple. I wanted to create an auto cd burner. That routine 
would help!
Pekr
9-Jul-2007
[7102]
can I somehow have layout defined in the manner, that I can:


1) reinitialise it (I can imagine something like store-screen: [copy-dir-screen: 
layout []] do store-screen

2) how can I "unset" it, "uload" it, whatever, to be able to reset 
all its words?
ICarii
9-Jul-2007
[7103]
like this?
window: func [param1 param2 param3 ..][
	layout compose/deep [btn "Exit" [unview face/parent-face]
]
Pekr
10-Jul-2007
[7104x2]
Thanks, that might work, but not sure it is what I want. Maybe I 
don't need it, so here come further questions:

- I want to run infinite loop script
- I want small screen to be displayed during copy

- I want to keep memory low, so I want to "unload" all screen related 
objects from memory


Now - is that possible? With above wrapping function, by calling 
it, I can get new/fresh layout, so variables being reinitialised. 
But when the copying is done, can I remove objects defined by layout 
from memory? Unsetting 'window will just unset the function, but 
I am not sure it following would help?

window: does [copy-screen: center face layout []]
forever [
view/new window
copy-dir
unview copy-screen

unset 'copy-screen (and other VID defined words referring to styles)
recycle
]

?
hmm, above does not free any significant memory ....
btiffin
11-Jul-2007
[7106x2]
Pekr;  This is in free-mem.r from the library by DocKimbel and Shadwolf...I 
haven't played with it, and I don't know if it's any better than 
unset with newer REBOLs
; the free mem function
free-mem: func ['word] [set :word make none! recycle]
unset in 2.7.5.4.2 frees memory,  1.3.2.4.2 unset does not but make 
none! 0 does lower system/stats on a recycle.   I think make none! 
2000'000'000 will work too, but that seems kinda funky.  :)
Pekr
17-Jul-2007
[7108]
What would be the best strategy to take, to achieve following? Imagine 
app with say 20 forms. It is insane and unnecessary to keep everything 
in memory. We should have even option to prevent tabs from doing 
so.


So I am thinking of a method to load/unload screens (forms), but 
freeing a memory. Of course you want to remember the state of widgets. 
So - can I somehow save the form, state of its widgets, unload it 
from memory, and load and reinitialise it at will?
Graham
17-Jul-2007
[7109]
memory is cheap
Pekr
17-Jul-2007
[7110x4]
:-)
That might be a solution :-)
what I am asking for though, is kind of cocneptual aproach to the 
topic, if you would think memory constrained environments for e.g. 
Just curious, what the possible aproach could be ....
other than that, I do agree with your argument :-)
Graham
17-Jul-2007
[7114x2]
how about defining the layouts and widget variables inside a function?
I do that a lot
ICarii
17-Jul-2007
[7116]
Pekr: i normally create view objects by using a func - but GC doesnt 
handle things very well with multiple calls to the same func :(
Graham
17-Jul-2007
[7117]
If you're memory constrained, I wouldn't use VID!
Pekr
17-Jul-2007
[7118x2]
That is my question in Core group - does function call, once finished, 
discard its context? If not, you will not save memory either. You 
would have to unset your func, recycle, and define it later once 
again ...
Graham - I am curious what will happen after R3 release. Theoretically, 
we should get VID more memory savy. I wonder if there will still 
be place for RebGUI (my opinion is - why not, right?)
Gregg
17-Jul-2007
[7120]
If you are *really* constrained, create your UI with draw commands 
and manage events and everything yourself. Of course, you may end 
up with so much more code that it's a moot point, so it depends on 
what constraints you have. 


It reminds me of when VB1 came out, and people tried to use thousands 
of text boxes to create spreadsheets, which was slow, resource hungry, 
and limited in size, because you could only create so many windows. 
The common question was "How does Excel do it then?", and the answer 
was that Excel (v3 at the time I thnk) created only 3 (or so) actual 
GDI windows, everything else was rendered, and interaction handled, 
dynamically
BrianH
17-Jul-2007
[7121]
If you are really, really constrained, use a wrapper around the native 
GUI controls for your platform, carefully. Only cell phones and other 
embedded platforms are that constrained though.
Pekr
17-Jul-2007
[7122]
Thanks for your input guys. I am not constrained that much. Our kiosk 
PCs do have 256MB of memory, being older PCs, some Duron 1.2 or so, 
WinXP. It runs presentation in full mode, local Apache based. Plenty 
of photos, simply kiosk presenation, not ordinary web pages. Dunno 
how IE is memory hungry. My script, which will run in background, 
easily eats some 39MB memory. I did some unsets, recycles, so while 
in wait mode, script goes down to some 24MB. It is that I was just 
curious how to aproach that ...
Gregg
17-Jul-2007
[7123]
Carl once said "View is miserly, saving pennies, while VID is like 
the government, spending millions".
Ingo
23-Jul-2007
[7124]
Hi, I'm trying to visualize data I get from a network port within 
a view window. IIRC using wait within a view handler is greatly discouraged 
(and my first tests seem to show it: the window is updated for the 
first info, but the updates stop after the second, or so. )
So, how do I connect to a tcp port from within /View?
ICarii
23-Jul-2007
[7125]
depending on your display needs you could set a rate in a view face 
for interval polling and catch the 'time event under engage - the 
application could then check a data pool/dump area that is being 
generated in a forever loop or something similar by a tcp watcher
Ingo
23-Jul-2007
[7126]
Hi ICarii ... what do you mean? Having 2 rebol instances, one that 
listens on tcp and creates a file, which is then read by the other, 
and used for display?
ICarii
23-Jul-2007
[7127x3]
data-i-want-to-display: [..............] ;probably a block
window: layout/tight [
	data-box: box 400x200 rate 0:00:0.001 feel [
		engage: func [f a e][

   if a = 'time [do-something-nifty data-i-want-to-display show f]
		]
	]
]
view/new center-face window
setup-port-listener
forever [
	check-my-port-and-update data-i-want-to-display

 ;add some window shutdown code to close ports etc after window closes..
]
but change the rate in the layout to whatever interval you desire 
for precision
make sure there is also some form of wait inside the forever loop 
or it will thrash about and not release any breathing room for view. 
 A wait of 0.001 typically takes processor usage from 100% to 1% 
as well.  Wait 0 inside a forever loop seems to stick at 100%.  Your 
mileage may vary ;)
Ingo
23-Jul-2007
[7130]
Ahhh, thank you. I'll try that next. And thanks for the wait timings, 
I'll try it out.
james_nak
21-Aug-2007
[7131]
Has anyone developed any code for a text field that can keep a history 
of previously entered values?
Henrik
21-Aug-2007
[7132]
I have built an enhanced text field, that does not have this capability, 
but it would be nice to have it.
james_nak
21-Aug-2007
[7133]
I know I saw that! I was thinking of just  using yours and adding 
that with the key action. BTW, the new List-View is great.
Henrik
21-Aug-2007
[7134]
feel free to mess around with it. :-)
james_nak
21-Aug-2007
[7135]
Well, I just saw list-view get updated with the mysql data. How cool.
amacleod
22-Aug-2007
[7136x2]
the new list-view is great
? is there a new version available?
I just saw list-view get updated with the mysql data
? Is there some mysql interface now in list-view?
Henrik
22-Aug-2007
[7138]
it supports object lists now. mysql views, I think he means that 
output from mysql-protocol.r fits in list-view.
amacleod
22-Aug-2007
[7139]
I've been using list-view with mysql-protocol for a while but the 
method I use to move data back and forth between mysql data and the 
list-view is not very elegant. Are there any examples of how object 
lists..mysql views work with list-view?
Henrik
22-Aug-2007
[7140]
object lists are not suited for mysql results. just use plain blocks 
in blocks, returned from the database. that works fine.
amacleod
28-Aug-2007
[7141x2]
hI'm trying to append to a face for export to a .png later. I'm able 
to append some text using something like: append gui [at 264x72 text 
"SOME TEXT" bold font-size 20]
That works fine, however, when I try to step through a block of data 
to be appended usinf FOREACH I only end up with the last item of 
data appended. Previously appended text remains but any text I attemt 
to append in the FOREACH loop does not "Stick". Any ideas?
Henrik
28-Aug-2007
[7143]
source example?