22 May 2013

Drag'n'drop in R3GUI

Back to using this blog (before I move somewhere else again)!
Let's start with something simple: @GrahamChiu was interested to see how to do drag'n'drop in R3GUI. Here is it:

Some explanation

DRAGGER is style used for dragging. It's simple box, but you can use anything you want.

Dragger / on-click

You need to define ON-CLICK actor to catch MOUSE-DOWN event:
on-click: [
    if arg/type = 'down [
        return init-drag face arg/offset
    ]
]
This will initialize and return the dragging object.

Dragger / on-drag

You also need to add ON-DRAG actor to process movement:
on-drag: [
    face/gob/offset: arg/offset - arg/base
    show face/gob
]
Argument for this actor is the drag object defined in ON-CLICK actor with INIT-DRAG function. The drag object holds original position and new offset (and also some other fields that are not interesting for this simple tutorial).

Dropper / on-drop

For faces that accept our DRAGGER face we need to implement ON-DROP actor:
on-drop: [
    append-content face arg/face
    return true
]
This actor just adds our DRAGGER face to target panel and returns TRUE to indicate everything went well.

Notes

If you drop the DRAGGER on face that has no ON-DROP defined, DRAGGER will return to original position automatically.

Conclusion

As you can see, it's fairly easy. Feel free to ask about details!

26 September 2006

What's new???

I don't know. Everybody's waiting for some new release. No new releases, no new articles in my blog. SAD.

13 March 2006


Literar programming

I was interested in literar programming and MakeDoc3 Gabrielle is now working on, but I was missing some code I can try. So I took great HyperNotes software and patched it with one new keyword - SCRIPT. On save, HyperNotes saves not just the notes file but all code between SCRIPT tags as REBOL script. Now I'll try to rewrite RebC (more on RebC later) using HyperNotesLP. You can see screenshot of my patched HyperNotes on the right. It show my simple index.r editor.

BTW, tommorow I'm thirty, so as John Lennon said, you cannot believe me from that date.

15 February 2006

So...

So...Competition is over, you can read the results on its page, I'll write something about Compo in my next blog. I've switched to MEPIS from Windows so I've got lot of maintaince work right now, sorry for no new posts.

05 January 2006

Blog is not dead

I'm just working on demo so I've no time to publish news. Wait till 10.1.2005

19 December 2005

REBOL DEMO CONTEST

Great! RDC 2005! Write best graphical demo in REBOL, fit it in 32 768 bytes and you can win:

1. iPod Video
2. XBox360 (or Mac Mini)
3. SDK or Command license (1st and 2nd too)

Isn't it great? Everybody's probably working on a demo now as deadline is on December 31st, 11:59:59 GMT. Submit your demos using dedicated web page (wait a moment, there's no such a web page still and the deadline is less than two weeks away!) and then wait.

And if you're waiting you can wait for Core 2.6.3 which is comming in January 2006. Together with View 1.3.3? Who knows. But we can hope.

So don't expect many new blogs till new year, as I'm trying to win iPod or XBox ;)

14 December 2005

Mail file sharing

Because I'm writing scripts on more than one computer I need to sync files somehow. I can use flashdisk for synchronization, but USB is not always available or I forget my flashdisk at home, so it's not always the right option.

Or I can use ftp to upload and download files. But at the end I've got lots of different directories with different versions, because I have no intelligent file structure.
I was inspired by Google filesystems for win and lin so I decided to use some freemail (gmail preferably) for my scripts maintaing. Unfortunatly, Gmail needs some authentication, SSL or what and SSL under REBOL needs Command and Command needs 350$ to buy.
So I found another freemail provider that offers both non-authenticated SMPT and POP and therefore is OK for REBOL (btw. remeber the old REBOL example? send [luke]@[rebol].[com] read http://www.rebol.com ? Hard to do with all the authetications required today.) and I started coding.

The result is a small application called %rspace.r that can upload file to repository, download newest version from repository, or you can get list of all files in repository and finally, if you're happy with your script, you can publish it on www/ftp. All this with documentation in less than 6kB.
All you need is REBOL and mail account cappable of SMTP/POP without authentication. It's good to have an FTP account for publishing files but that's not required. If you do not have an mail account, I've set up one on seznam.cz, user 'rebolspace' and pass 'spacerebol' for testing this application (it's built in, so you can start testing right after download).

Remember, it's just alpha, does not have many features, but it works, I can write something here, update it there and have all the versions accesible from everywhere. It's written for REBOL scripts so with big projects it's going to be very slow and unusable, but for small project (and most REBOL scripts are really small) it's probably good.

So download it form http://krutek.info/rebol/rspace.r (stable) or http://rebolspace.sweb.cz/rspace.r (latest published version).

WARNING: because [rebolspace]@[seznam].[cz] is open account it won't be wise to use it ordinarily. Please, if you like it, set up your own account and use it instead of built-in one.
And remember: all suggestions and fixes are welcome.