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

World: r3wp

[Rebol School] Rebol School

Vladimir
3-Oct-2007
[607x3]
That is what I do in key-event func....:  if event/type = 'time [
		? now/time
    	cursor_color: (3 - cursor_color)
Problem is that events are always happening the same rate... no matter 
what I do....
I tried to put rate:1 in my grid face.... I tried to put it in pixel_face... 
I tried to put it in pane-func...
Oldes
3-Oct-2007
[610]
Here is simplified your problem:
ke: func[f e][ if e/type = 'time [print now/time/precise] e]
insert-event-func :ke
view layout [box with [rate: 10]]


But I cannot help you. I'm not a view guru. It looks you should not 
use insert-event-func if you don't want to get all time events.
Vladimir
3-Oct-2007
[611x2]
:)
yeah... I guess its a mix between insert-event-func and iterated 
pane..... pane is generated every time and my adding rate element 
to it doesn't effect global rate..... thanks for answer!
Oldes
3-Oct-2007
[613]
Use somethink like:

view layout [
	box with [
		rate: 10
		feel: make feel [
			engage: func [f a e] [
				if a = 'time [print now/time/precise]
			]
		]
	]
]
Vladimir
3-Oct-2007
[614x8]
I'm just typing something like that.... :)
I will check if iterated pane is the source of problem....
pane is not a problem...... your code works (as it should) :)
I know it works, but I remember puting insert-event-func there for 
a reason.... If I remember I couldnt get keyboard response from my 
iterated pane somehow.... I'll try it again ....
Thanks for help!
Done it! All I needed was:  system/view/focal-face: grid
I guess I should read docs more :)
Sorry for spamming this gruoup... but I was wrong.... I mixed to 
source files... Editid one and ran another... so ... it still doesnt 
work.......
Oldes
3-Oct-2007
[622x2]
If you want just blinking cursor, don't use insert-event-func, but 
just something like that:
cursorMover: func[f e][
	if e/type = 'key [
		switch e/key [
            up    [cursor/offset/y: cursor/offset/y - 10]
	        down  [cursor/offset/y: cursor/offset/y + 10]
            left  [cursor/offset/x: cursor/offset/x - 10]
            right [cursor/offset/x: cursor/offset/x + 10]
		]
		show cursor
	]
	e
]
insert-event-func :cursorMover

view layout/size [
	cursor: box 10x10 with [
		rate: 10
		colors: [0.0.0 255.255.255]
		feel: make feel [
			engage: func [f a e] [
				if a = 'time [
					f/color: first head reverse f/colors
					show f
				]
			]
		]
	]
] 400x400
(I mean don't use the insert-event-func for changing color but only 
for geting the key events)
Izkata
3-Oct-2007
[624]
It looks like the event function isn't being triggered for the box, 
but rather for system/view/screen-face or something -

>> ke: func [f e][if e/type = 'time [print f/text]]
>> insert-event-func :ke
>> view layout [box "Testing" with [rate: 1]]
none
none

None of them print "Testing", as a call from the box should
Vladimir
3-Oct-2007
[625x4]
Thanks Oldes! I did it.... I used insert-event-func for key events 
and feel for time events....
But, why? Ohhhh why do I need to do it like that? :)
I red part of docs (6.4 Focus and Keyboard Events)  but it doesnt 
help......... Well so far I'm ok, my editor can move on.... :)
But I would love to know: How to set key press event on something 
so that it would be timed? Or how to make insert-event-func function 
get called in precise timed intervals?
Oldes
4-Oct-2007
[629]
insert-event-func is simply used for global events, you can use it 
to detect 'close, 'resize, 'active and 'inactive as well. Why you 
should have such a event handlers in feels?
Vladimir
4-Oct-2007
[630]
I'm actually interested only in keypress events...

But I have to limit the rate of events... I know there is the rate 
element in every face, and I did make it work for time event and 
that is ok.
But I couldn't make keypress event occur in timed intervals.

I'm not saying I have to have it. Maybe it just isnt supossed to 
be. But it says in docs:


The focal-face must be set to a valid face object (one that is part 
of a pane in the face hierarchy) and the system/view/caret (explained 
in next section) must also be set in order to:
   1. Receive keyboard 
events ....

So I put this inside engage func:

system/view/focal-face: face
system/view/caret: tail ""


And now it works... I dont even use caret but you have to set it 
to some bogus value!


So in my opinion rate element has no influence on key events (if 
I type like crazy I get 19 key events for 1 second...).

But I can make some sort of counter and simply do keypress response 
only when I want to...
Gregg
4-Oct-2007
[631]
The event handling system will call your insert-event-func handler 
as fast as it can, if there are availalbe events, and there will 
always be time events, occurring at whatever rate REBOL uses them. 
I don't know of any way to control when, or how often, your func 
is called.
Vladimir
4-Oct-2007
[632]
Its ok like this... :) I can make what ever I need for my editor 
using this method. I guess things will be more controllable in R3...
Thanks again for help!
Anton
7-Oct-2007
[633x2]
Vladimir, the window/feel gets time events at full speed. Any subface/feel 
gets time events at subface/rate.
So,  I advise to trap events in subface/feel/engage, not in window/feel 
or screen-face/feel.

(insert-event-func adds a handler which is processed in screen-face/feel)
Vladimir
26-Oct-2007
[635]
What could be problem with this script?

set-net [[user-:-mail-:-com] smtp.mail.com pop3.mail.com] 
today: now/date
view center-face layout [
		size 340x120
 		button "Send mail" font [size: 26] 300x80	[

    send/attach/subject [user-:-mail-:-com] "" %"/c/file.xls" reduce [join 
    "Today  " :danas]
 			quit
 		]
	]

I get this error:


** User Error: Server error: tcp 554 5.7.1 <[user-:-mail-:-com]>: Relay 
access denied
** Near: insert smtp-port reduce [from reduce [addr] message]

Could it be some security issue?

It worked with previous internet provider... A week ago we changed 
it and now this happens...

Should I contact my provider to change some security settings or 
should I change something in the script?
Pekr
26-Oct-2007
[636x3]
The problem probably is, that you are trying to send your email from 
outside of @mail.com domain.
smtp servers usually don't allow you to send email via themselves, 
if you are not part of particular network, or they require authentication 
to smtp - usually your accont name and password is enough. I think 
that in such case, you are out of luck with REBOL. Not sure our smtp 
protocol can handle it ... but - go to www.rebol.org and try to search 
for "smtp" - there are some scripts which could help you ....
before you do so though, please try to configure your mail client 
(FireBird, Outlook), to see what kind of setting you are heading 
for, as the problem as well can be related to some other issue :-)
Vladimir
26-Oct-2007
[639x5]
I just set up outlookexpress and "my server requires authentication" 
is a problem....
:(
So this means my old provider was not that rigid on smtp control.... 
uffff.... :)
is there a way to give this user authentication data to it? Ill check 
rebol.org for that...
I would think  someone else already came with a solution for such 
acommon problem..........
Pekr
26-Oct-2007
[644]
try to look for esmtp. Usually there is a requirement for sending 
your user account name and pass. Hopefully you can find something 
...
Vladimir
26-Oct-2007
[645]
I found it! :)
all you need to do is add info in set-net fields....
instead of this:
set-net [[user-:-mail-:-com] smtp.mail.com pop3.mail.com]
use this:

set-net [[user-:-mail-:-com] smtp.mail.com pop3.mail.com none none none 
"user" "pass"]

Im happy :)
Pekr
26-Oct-2007
[646]
heh, I know there can be user and pass set, I just did not know it 
could be set via set-net, I always used max of 6 params for the function 
:-)
Brock
26-Oct-2007
[647]
I thought the problem may have been that the first character following 
set-net is a "|" characther rather than theh "[", that must just 
be a typo.
Vladimir
26-Oct-2007
[648x2]
Now it works...
This functionality was not present in previous versions of rebol... 
I think it was introduced in some patch this year... By the way I 
dont know wich version of view I use on every other pc... one at 
home, one at work... laptop... I will download newest and update 
all.... :) Thanks for help...
Vladimir
29-Oct-2007
[650]
How complicated is it to make simple file transfer between two computers 
(one client and one server) in rebol?
What protocol should I use?
Any ideas?

Currently I'm sending e-mails from clients with file-atachments because 
its the simplest way of collecting data from clients. (so far they 
were doing it by hand -  so this is a big improvement :)
Henrik
29-Oct-2007
[651]
how big files are you transfering?
Gregg
29-Oct-2007
[652x2]
There are a lot of ways you could do it, FTP, LNS, AltMe file sharing, 
custom protocol on TCP. It shouldn't be hard, but I would try to 
use something existing. The devil is in the details.
You could also write a custom app that sends via email, and a reader 
on the other end that grabs them.
Graham
29-Oct-2007
[654x2]
I've done file transfer using async Rebol rpc, and also using Uniserve
I think Carl posted some code on how to do huge file transfers.
james_nak
30-Oct-2007
[656]
Here is something from the rebservices section from Gabriele:

client has experimental generic http proxy support; server has the 
new, much improved file service. see http://www.rebol.net/rs/demos/file-client.r
for example usage to transfer big files.