Drag cursors (curses!!)

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by pillick >> Sun, 25 Aug 2002 22:32:19 GMT

Is there anything special about the drag cursor property?

I've made my own cursor by creating a bitmap and just renaming it to be **.cur and set this up in painter as the dragCursor of a control. The cursor looks fine in the property window. But when I run the form and drag the control, it still uses the standard dragCursor - that white folder thingie??

Are there some special constraints on cursors or something (proportions, colors, etc) that stops my custom cursor from being used?

Also, does anyone have any ideas on how to create a dragCursor on the fly that looks like the thing your dragging (i.e. dynamic text). Would it be possible to take a snapshot of the contents of a frame and use that?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by allistar >> Mon, 26 Aug 2002 0:34:17 GMT

Hi there,
You need to make sure that it is a standard .cur file (made with a proper cursor editor such as the resource editor in MS Visual Studio), and it needs to be 32x32 and only 8 bit colour.

You could look on the internet for the format specification of a
..cur file, then you could take a snapshot of the window in question (using the Control.createPicture method) and create a .cur image and
use that as the drag cursor.

Look here for details of the .cur format:

http://www.daubnet.com/formats/CUR.html

Regards,
Allistar. ------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND

Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by pillick >> Mon, 26 Aug 2002 2:08:14 GMT

It absolutely HAS to be 32x32? What a pain in the ass >.<

Why is this? Windows itself doesnt seem to have this restriction - It can drag stuff in any shape...

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by allistar >> Mon, 26 Aug 2002 2:34:13 GMT

I found that if it was 16x16 it stretched it to 32x32 anyway, which
was annoying. I assumed that 32x32 is the limit.

What you can do as a kind of hack is to create a control at runtime
(of type Label for example) and do this with it:

create label transient;
label.parent := form;
label.top := x;
label.left := y;
label.text := "Some text to drag";
label.autoSize := true;
label.transparent := true;
form.addControl(label);

then on the mouseMove event of the label you add code to move the
label (it would be easiest to subclass the Label class to do this).
When you get a mouseUp event on the label that means the user has done
a "drop". You could then work out which control is under the cursor
and simulate a dragDrop event on that control.

Doing it like this you aren't really using Jade's drag and drop functionality, but it does allow you to have your drag cursor as
anything you want (a transparent label would look quite cool).

We have done similar drag and drop stuff in our product (to allow
users to drag and drop gui objects wherever they like).

Regards,
Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND

Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by pillick >> Mon, 26 Aug 2002 4:29:53 GMT

hmmm, I've thought of a work around, but it seems pretty complicated:

I want to be able to drag the thing between forms, so I dont thing a frame will be enough.

So what about an entire form, with no border so it looks exactly like the thing I want to drag? this would follow the mouse around..... I allready know how to do that - I've made my toolbars do the same thing (they dont have captions, so it was the only way to let the user move them)

Think I'm on the right track???? Seems like I'm swatting a fly with a mace....

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by allistar >> Mon, 26 Aug 2002 5:00:51 GMT

There may be an easier way to change the mouse cursor to any picture format (not only 32x32 .cur). Moving a borderless form around should
work too, although it may be tricky to get it to appear see through
(it that's what you want).

Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND

Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by pillick >> Wed, 28 Aug 2002 21:55:14 GMT

Hehe, I got everything working perfectly. Ended up not using any part of the jade drag & drop support... ah well.

But yeah, now that I think about it, transparency would be cool - It gets a little hard to see where you are dropping stuff sometimes. Any ideas on how you would do that?

Or is a semi transparent form simply out of the question?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by CarlRanson >> Wed, 28 Aug 2002 22:42:17 GMT

You didn't use the proper windows shell drag and drop API did you? If so please tell us how you did it.
CR

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by pillick >> Thu, 29 Aug 2002 1:32:11 GMT

nope, sorry. I just used the mouseDown and mouseMove events in jade.

Do you want details?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Drag cursors (curses!!)

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:12 pm

by allistar >> Thu, 29 Aug 2002 1:07:27 GMT

Hey there,
I'm pleased you got it working. Instead of dragging a form, can you drag a control whose parent is the MDI frame form? Maybe that will
allow you to drag between forms.

You could do some trickery in C++ to set the WS_EX_TRANSPARENT
extended style of a window. You could pass the hwnd handle of the form
to a c++ dll method that does something like this:

CWnd window;
window.Attach(hwnd); //hwnd comes from Jade
window.ModifyStyleEx(0, WS_EX_TRANSPARENT, 0);
window.Detach();

I have not tried this and don't know if the controls on the form will also become transparent (which would be pretty useless), but this may
do the job. I also don't know if Jade will like this or if it will
revert the setting back to opaque again, but it is worth a try.

Regards,
Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer
Auckland, NEW ZEALAND

Greentree International,
Developer of Greentree Financial Software. ------------------------------------------------------------------


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 17 guests