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 

Focus lost after closing universal editor form

 
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: Tue Dec 02, 2008 1:29 pm    Post subject: Focus lost after closing universal editor form Reply with quote

We are using a virtual tree in an Interop Usercontrol, so that this control can be used on a VB6-form. The virtual tree looks like the Custom Type Editor sample. Values in the tree can be changed by pressing the little button in the edit field, and then a form is opened to select a new value, like what happens in the StockLevelEditor:

Code:
    Public Overloads Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object
        Dim editorService As IWindowsFormsEditorService
        editorService = CType(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService)

        ' create and initialize our form
        '
        Dim form As New StockLevelForm
        form.Part = context.Instance
        form.StockLevel = value

        ' use the editor service to display the form
        '
        editorService.ShowDialog(form)
        If form.DialogResult = DialogResult.OK Then
            Return form.StockLevel
        End If
        Return value
    End Function 'EditValue


However, when the user presses OK in the form, the new value is inserted in a field in the tree, but this field is not active. So when I press ENTER, nothing happens.

Is there a way to make this edit field (from where the form is opened) active again at the moment that the form is closed?

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Dec 02, 2008 10:19 pm    Post subject: Reply with quote

This isn't the behaviour you get with the Custom Type Editor sample. When you click OK on the editor form the UniversalEditBox control still is active. Are you saying that the behaviour for your control is different? If you use your control inside a standard windows form (instead of via COM interop) does it work the same?
_________________
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: Wed Dec 03, 2008 3:21 pm    Post subject: Reply with quote

Yes, the behaviour for my control is different.
The Custom Type Editor sample works fine.
When I test my control in the VB.NET UserControl Testcontainer (by pressing F5) there are no problems, but when I use this control in a VB6 project, it seems that after opening and closing a form which is made in VB.NET, the focus is lost.

I solved this by setting

Code:
      MyTree._VirtualTree.EditWidget.EditorControl.Focus()


after the form is closed in the EditValue function.
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