Default property problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Default property problem

Hybrid View

  1. #1
    Paulo Costa Guest

    Default property problem

    Hi all,

    For the first time I am creating a control with the Default property and it
    doesn´t work at run time. At authoring time I set the DefaultCancel property
    to True and the container add the Default and Cancel properties to the
    extender object. At design time I can set Default and Cancel properties but
    at run time it doesn't work: the control that has TabIndex = 0 becomes the
    default control and has the focus. This happens to all of the controls that
    have the Default property when one instance of my control is present in the
    container.

    Example: I put a control (mine) and a Command button on a form and set the
    control's Default property to False but if it's TabIndex is = 0, at run time
    as the form is loaded the control gets the focus.

    I found that the property UserControl.Ambient.DisplayAsDefault is unchanged
    till the Show event is fired. The sequence of events is this:
    1 - ReadProperties event: (DisplayAsDefault = False)
    2 - Resize event (DisplayAsDefault = False)
    3 - AmbientChanged event (DisplayAsDefault = *True*)
    4 - Show event (DisplayAsDefault = True)

    Any ideas to put my control working properly?

    Thanks in advance,
    Paulo Costa



  2. #2
    Michael Culley Guest

    Re: Default property problem

    The default property does not determine which control gets the focus first.
    If a control has tabindex of zero, it will get the focus. In the case of
    command buttons, it will cause the command button to receive a click event
    when the user pushes enter.

    --
    Michael Culley
    www.vbdotcom.com



  3. #3
    Paulo Costa Guest

    Re: Default property problem

    That's true but I thought that it was because of the presence of my button
    control. Simple stuff sometimes...
    Anyway I could give this functionality to my button control through the
    Extender Object, it holds the Default Property set at design time.

    Paulo Costa

    "Michael Culley" <mculley@optushome.com.au> wrote in message
    news:3d3bb23b@10.1.10.29...
    > The default property does not determine which control gets the focus

    first.
    > If a control has tabindex of zero, it will get the focus. In the case of
    > command buttons, it will cause the command button to receive a click event
    > when the user pushes enter.
    >
    > --
    > Michael Culley
    > www.vbdotcom.com
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center