Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get selected text when editing

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
AB



Joined: 20 Nov 2007
Posts: 23
Location: Netherlands

PostPosted: Wed Nov 05, 2008 4:34 pm    Post subject: Get selected text when editing Reply with quote

In my treeview a textbox is used as a cell editor. When I press F2 editing is started for this cell and I can change the text, and also select a part of the text. Is there a way to get this selected text during editing?
I'd like to show a search-form when Ctrl-F is pressed during editing, and fill in the selected text, so that I can search for this text through the whole tree. I know which cell (row and column) is selected, but how can I get the selected part of the text when this cell is being edited?

Thanks,
Anja
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Nov 05, 2008 9:22 pm    Post subject: Reply with quote

With the latest version (3.11.0) you can do the following:

Code:
private string GetSelectedText()
{
    string text = null;
    CellWidget editWidget = _virtualTree.EditWidget;
    if (editWidget != null)
    {
        TextBox textBox = editWidget.EditorControl as TextBox;
        if (textBox != null)
        {
            text = textBox.SelectedText;
        }
    }
    return text;
}


Note that the EditWidget property was only made public in 3.11.0. Previously it was protected - for earlier versions you could derive a new class from VirtualTree and add this function as a member method.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
AB



Joined: 20 Nov 2007
Posts: 23
Location: Netherlands

PostPosted: Mon Nov 17, 2008 9:43 am    Post subject: Reply with quote

I tried the new version and it works fine. Thanks a lot for your support.

Anja
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group