FLTK logo

Re: The Fl_Input drag and drop ?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: The Fl_Input drag and drop ? lucas.sanner-GANU6spQydw Oct 17, 2007  
 
Stan wrote:
>I'm not sure exactly what you're referring to,

Fl_Input widget allows you to drag the selected text and to drop it somewhere else in the widget or in an other Fl_Input widget. It's very handy but I don't need it at all in my app.

> it sounds like you want to make a subclass of Fl_Input and implement >its handle() method to do whatever it is you want done.

Yes, that's what I did.

I noticed that the use of cut() insert()  or replace() function cancel this dnd mechanism.
So the trick is to use the replace function without altered the value.

 case FL_PUSH:

  if(mark() != position())
  {
   char first = index(0); //Retrieves the first charactere of the value
   const char* pFirst = &first;
   replace(0, 1, pFirst, 1); //and replace it with...itself
  }

I know it looks twisted but so far it's the only way I found to get a
classical selection in an Fl_Input widget.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.