The FXTreeList class I ended up writing for my program is a horrible, slow,
complicated tangle of code. :| I couln't find a way to reorder items
manually. If you look in the latest Fox source, FXTreeList now has a
'moveItem' sort of command that just hasn't been propagated into FXRuby yet.
As to now, I think you have to delete the item and re-create it in the new
position with 'addItemBefore' and 'addItemAfter'.
I got drag and drop working (not on a tree list) with a combination of
Lyle's tutorial and some posts on the Fox mailing list. I think it's so
complicated because it's meant for transferring data between applications,
when all I wanted was in the same application. Dragging an object seemed
confusing to me for that reason. What I ended up doing when I wanted to
drag and drop a ruby object is just copy it's Object::id into a flat string,
drag that, and then just 'id2ref' the object into existence on the other
side, rather than go to the trouble of packing the entire object. It
doesn't work between applications, but it works in my case.
I'm not sure about the state of dragging FXTreeList items...it seems like
there is some partially working code in Fox for doing that, and that's
probably where it should be implemented. I have some code that figures out
which item the mouse is hovering over, if you find that useful. It would be
awesome to have a more ruby-friendly version of FXTreeList.
Those are my rambling notes. :) Maybe someone else knows better. Good luck
anyway,
Oliver
> -----Original Message-----
> From: fxr...@li...
> [mailto:fxr...@li...]On Behalf Of Hal Fulton
> Sent: Saturday, May 22, 2004 12:06 AM
> To: fxr...@li...
> Subject: [Fxruby-users] Thoughts on the tree list
>
>
> OK, I'm making slow and painful progress on this app of mine
> (http://tycho.rubyforge.org).
>
> Eventually I want to fix the tree list so that the items can
> be re-ordered manually.
>
> This is daunting to me. A few months ago I read about the
> cut-and-paste API, which I thought would be trivially simple
> and is not at all. I also read about drag-and-drop, which is
> somewhat related, and it is even more painful.
>
> The tree list itself is thorny to understand, and drag/drop
> is even worse. Doing drag/drop inside a tree list sounds as
> exciting as a trip to the dentist in a third world country.
>
> Wouldn't it be nice if someone wrote a widget (probably
> inheriting from the tree list) which could be rearranged in
> such ways, and was smart enough to "reflect" itself in a
> tree datastructure? Then we could plug in such a widget without
> worrying about writing that extra 200 lines of code, no?
>
> But I'm just dreaming there. There's probably some reason it's
> not doable that way.
>
> Anyhow, if anyone has any words of wisdom in this area, I'll be
> glad to listen...
>
>
> Cheers,
> Hal
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g.
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
> _______________________________________________
> Fxruby-users mailing list
> Fxr...@li...
> https://lists.sourceforge.net/lists/listinfo/fxruby-users
>
|