New topic: 

Drag from Listbox to Textfield-

<http://forums.realsoftware.com/viewtopic.php?t=40184>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        RickHebert          Post subject: Drag from Listbox to 
Textfield-Posted: Sun Aug 07, 2011 3:23 pm                         
Joined: Sat Jul 16, 2011 9:01 pm
Posts: 14                Hello


How do I set the property for the TextField to accept drag items? 

I am trying to allow a user to drag text from a listbox into a text box to fill 
the textfield.
In the listbox I have enabled "EnableDrag" and "EnableDragReorder"

I am new to RealBasic and I have tried using examples from the user manual but 
to no avail.
I have searched the forum but haven't found anything yet.

I get the drag item graphics that follows the cursor but nothing happens when I 
try to drop the value.
I am reading about the "RectControl" base class but I do not fully understand 
what the User Manual is trying to tell me about it. It says;

Quote:RectControl.AcceptTextDrop ( ) 
Permits text to be dropped on the control.

and then when I look up RectControl;

Quote:RectControl is the base class for most other control classes. This means 
that all controls inherit the properties of the RectControl. A RectControl 
cannot be created or modified directly. Instead, you create and modify the 
RectControl subclasses

Please explain or a link to a good example of doing this would be greatly 
appreciated

Thanks   
                             Top                 harriew          Post subject: 
Re: Drag from Listbox to Textfield-Posted: Sun Aug 07, 2011 5:01 pm             
            
Joined: Fri Dec 01, 2006 3:09 pm
Posts: 543
Location: Tennessee, USA                Your best bet is to look at Chapter 5 
of the User's Guide titled: "Drag and Drop". That chapter will show you the 
pieces that need to be set and where to set them for what you are trying to 
achieve.

Easiest way to get there is to open the online help from within the IDE and 
then type "accepttextdrop" in the search field and press the Return/Enter key. 
One of the items returned from the search will be: "UsersGuide: Chapter 5: Drag 
and Drop". Click on that and you should get the needed info. When learning 
something new like that I often find it useful to also have a text editor of 
some sort open and cut and paste text from the Users Guide into the Text Editor 
to look at back in the IDE. It is faster and easier than bouncing back to the 
online help in certain cases.   
                             Top                 RickHebert          Post 
subject: Re: Drag from Listbox to Textfield-Posted: Sun Aug 07, 2011 6:38 pm    
                     
Joined: Sat Jul 16, 2011 9:01 pm
Posts: 14                Very good!
Just what I was looking for, thank you very much.

I am working through this and I feel I am very close to success.

The text object is being dragged and when I hover over the TextField the symbol 
changes from the circle/bar no-go symbol to the "box" symbol indicating that 
the drop might be acceptable.

When I release though nothing happens.

I have the following code verbatim from the manual in the DragRow event for the 
ListBox;
Code:Function DragRow(Drag as DragItem, Row as Integer)
---------------
Drag.Text=Me.List(Row)+chr(13) //get the text
Return True //allow the drag


Then in the Open event for the TextField
Code:  Me.AcceptTextDrop
 
In the DropObject event for the textfield I have the following code verbatim 
from the manual 
(this code throws a method/property does not exist, I have to remark out this 
following code to get as far as I have so I'm still studying it)

Code:Sub DropObject(Obj as DragItem, action as Integer)
-------------------
If Obj.FolderItemAvailable then
Call Me.Open(obj.FolderItem) <------ this line throws method/property not exist
End if


I have also tried this and got the same error;
Code:  If Obj.TextAvailable then
  Call Me.Open(obj.Text)
  End if

I am trying some things and studying but so far no success.
Thanks for the pointer though!   
                             Top                 RickHebert          Post 
subject: Re: Drag from Listbox to Textfield-Posted: Sun Aug 07, 2011 8:01 pm    
                     
Joined: Sat Jul 16, 2011 9:01 pm
Posts: 14                I found out what the problem was....

The TextField's "Super" property needed to be changed to TextArea.

After that I did not need to put anything in the "DropObject" event   
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to