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) » [Drag & Drop] How to reject Clip on base of content of data?
icon5.gif  [Drag & Drop] How to reject Clip on base of content of data? [message #37710] Sun, 04 November 2012 20:00 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Let say I want to allow dropping of only one file. Code below doesn't work because data in Clip is not available till drop time.

void XXX::DragAndDrop(Point p, PasteClip& d)
{
	if (AcceptFiles(d))
	{
		Vector<String> files = GetFiles(d);
		
		if (files.GetCount() > 1)
			return d.Reject();
		
		const String fn = files.Top();

		if (TryOpenFile(fn)) {}
	}
	
	if (d.IsAccepted())
	{
		Vector<String> files = GetFiles(d);
		
		if (files.GetCount() > 1)
			return d.Reject();

	}
}



I could use d.Get("files"), but GetFiles(d) takes a Clip as an argument and not actual data ...

Is there a way to do what I want without reimplementing of GetFiles()? And why data should be available only at the time of drop?

TIA


Regards,
Novo

[Updated on: Sun, 04 November 2012 20:45]

Report message to a moderator

Re: [Drag & Drop] How to reject Clip on base of content of data? [message #37724 is a reply to message #37710] Mon, 05 November 2012 20:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
You are right. I have now "separated" raw processing:

void DndTest::DragAndDrop(Point p, PasteClip& d)
{
	if(d.IsAvailable("files")) {
		files = GetClipFiles(d.Get("files"));
		Refresh();
	}
}
Re: [Drag & Drop] How to reject Clip on base of content of data? [message #37725 is a reply to message #37724] Mon, 05 November 2012 21:26 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Thanks a lot!

Regards,
Novo
Previous Topic: [FIXED] Full screen bug on additional screens. (GNU/Linux)
Next Topic: Regexp is not working
Goto Forum:
  


Current Time: Thu Mar 28 09:59:27 CET 2024

Total time taken to generate the page: 0.01125 seconds