Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Image DnD into Upp app
Re: Image DnD into Upp app [message #44170 is a reply to message #44169] Wed, 14 January 2015 22:09 Go to previous messageGo to previous message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Thank you for the code, Mirek, but I'm afraid it doesn't work. BTW, before I posted this topic I've tried something quite close to what you suggest, based on what I could learn from the IDE help and reference code, but it failed too.
I've inserted some LOGs in your code to see if any of the DnD-related virtual methods ever get called, which they don't, with the exception of CancelMode(), but obviously for other non-DnD reasons:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct MyApp : TopWindow {
	virtual void CancelMode();
	virtual void Paint(Draw& w);
	virtual void DragAndDrop(Point p, PasteClip& d);
	virtual void DragLeave();

	Image img;
	bool  dnd;
	
	MyApp() { dnd = false; }
};

void MyApp::Paint(Draw& w)
{
	Size sz = GetSize();
	w.DrawRect(sz, dnd ? SColorInfo() : SColorFace());
	w.DrawImage(0, 0, img);
}

void MyApp::DragAndDrop(Point p, PasteClip& d)
{
	LOG("DragAndDrop");              // this never gets called
	if(AcceptImage(d))
		img = GetImage(d);
	dnd = d.IsAccepted();
	Refresh();
}

void MyApp::DragLeave()
{
	LOG("DragLeave");                // this never gets called
	CancelMode();
}

void MyApp::CancelMode()
{
	LOG("CancelMode");
	dnd = false;
	Refresh();
}

GUI_APP_MAIN
{
	MyApp().Run();
}


Aren't we missing something? There's something I do not quite fully understand here, I mean, how is our code supposed to acknowledge it should accept DnD data from other non-Upp Windows processes? Doesn't Windows require us to somehow register our Upp process as potential target of DnD events?

Thanks again!

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Context Menu request
Next Topic: rounding to decimals implementation
Goto Forum:
  


Current Time: Thu May 16 15:45:35 CEST 2024

Total time taken to generate the page: 0.02639 seconds