in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Focus a RIBBONCOMBOBOX in a Ribbon Menu

Last post 07-07-2008 12:42 PM by C1_AndreyD. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-04-2008 3:33 PM

    Focus a RIBBONCOMBOBOX in a Ribbon Menu

    How I can set the focus of a RibbonComboBox built in a Ribbon Menu? Thanks! Gustavo
  • 07-04-2008 4:12 PM In reply to

    Re: Focus a RIBBONCOMBOBOX in a Ribbon Menu

    It seems to me there is no difference between comboboxes in a ribbon menu
    and, for example, in a ribbon group. You may assign either the SelectedIndex
    property or the SelectItem, such as:

    RibbonComboBox1.SelectedIndex = 3
    RibbonComboBox1.SelectedItem = RibbonButton2

    Let me know if I'm misunderstanding your question.

    Regards,

    -Andrey
  • 07-04-2008 4:22 PM In reply to

    Re: Focus a RIBBONCOMBOBOX in a Ribbon Menu

    There is actually a bug in the RibbonComboBox that prevents focusing items
    from keyboard. We'll try to fix this bug ASAP, then I will let you know.

    Regards,

    -Andrey
  • 07-04-2008 4:52 PM In reply to

    Re: Focus a RIBBONCOMBOBOX in a Ribbon Menu

    Hi Andrey!

    Thank you for your prompt response. May be I didn't explain myself well enought.

    I have a form that only has a ribbon on the top. The ribbon has a ONE BUTTON called connect. This connect option should be enabled if you type the right IP address in the combobox inside the Ribbon Menu. The problem I have is that I can't tell the cursor to go by default to the ComboBox. I need some sort of FOCUS function to tell the cursor where to start when the application starts.

    What you suggested me didn't work, because I don't have elements in the list because is the first time someone is using it. The list will grow slowly in the future.

    Regards,

    Gustavo

     

  • 07-04-2008 5:50 PM In reply to

    Re: Focus a RIBBONCOMBOBOX in a Ribbon Menu

    Hi Gustavo,

    Yes, we have no the Focus() function in the ribbon items. We'll
    consider adding such a function in the future versions. Right now
    you may use a trick that allows to focus the ribbon combobox
    when the application starts. See the sample in the attachment.

    Here is the main code snippet from that sample:
    -------------------------------------------------------------------
    Private FirstTimeVisible As Boolean = True

    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load

    AddHandler IPCombo.TextBox.VisibleChanged, _
    AddressOf IPComboTextBox_VisibleChanged

    End Sub

    Private Sub IPComboTextBox_VisibleChanged(ByVal sender _
    As System.Object, ByVal e As System.EventArgs)

    If FirstTimeVisible Then

    Dim tb As TextBox = IPCombo.TextBox
    If tb.Visible And tb.Parent IsNot Nothing Then

    tb.Focus()
    FirstTimeVisible = False

    End If

    End If

    End Sub
    -------------------------------------------------------------------

    Hope this will help.

    Regards,

    -Andrey
  • 07-07-2008 12:10 PM In reply to

    Re: Focus a RIBBONCOMBOBOX in a Ribbon Menu

    Hi Andrey!

    It didn't work. The first problem I have is that the system is not happy with Handles MyBase.Load statement.

    Regards,

    Gustavo

  • 07-07-2008 12:42 PM In reply to

    Re: Focus a RIBBONCOMBOBOX in a Ribbon Menu

    Hi Gustavo,

    How does the attached sample work?

    The 'Handles MyBase.Load' statement declares that
    the procedure handles the Form.Load event.

    Let me know if you're working in C#.

    Regards,

    -Andrey
Page 1 of 1 (7 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.