Results 1 to 6 of 6

Thread: Creating something similiar to tooltip[RESOLVED]

  1. #1

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Creating something similiar to tooltip[RESOLVED]

    I want to display a balloon window when a user neglects to enter data in a required field (textbox).

    Since we will have about 10-15 of our custom textboxes on a form, i really want to have a manager of sorts similiar to the ToolTip component, where only one balloon will pop up at any time. Each form will have an instance (and only one instance) of the component manager.

    What I envision is the textbox raising a public event of its own, declaring its not valid. The component manager will consume the event, and display a balloon window next to the control on that control's parent form whenever that declared itself invalid.

    I imagine this should be similiar to how ToolTip component works.


    Any suggestions on how to consume the events. The component manager doesn't need a visual interface, as tooltip doesn't.

    But it does need to repaint the windows in the event the user resizes the form, so I need to be able to somehow hook into the Form's onpaint and resize message.s
    Last edited by nemaroller; Oct 20th, 2003 at 12:17 PM.

  2. #2

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Here's a mockup im making to work out the balloon drawing quirks...
    Attached Files Attached Files

  3. #3

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    The mockup simply paints the window using the Paint event of the textbox, onto the parentForm's graphics object.

    However, as you know, this will not persist the balloon if the form is resized since the form only invalidates the textbox, not anything it draws on the form elsewhere. If I could somehow hook into the parentForm's onPaint event through the textbox, and have it repaint the ballloon, i would not even need a component to consume those events.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    What part do you need help with? Making the item appear like a tooltip or The Extender type control? Here is an example of an extender. It adds Icons to menus via an Extender control. It should be a good example of how to make the Extender aka Component Manager type control.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Sorry I didn't see that last post. You can hook into the Form's Paint event by setting a reference to it. Which shouldn't be hard considering the control is on it. I'll post code in a sec.
    VB Code:
    1. Public Class SuperTextBoxEx
    2.     Inherits SuperTextBox.SuperTextBox
    3.  
    4.     Private WithEvents _frm As Form
    5.  
    6.     Private Sub SuperTextBoxEx_ParentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ParentChanged
    7.         _frm = Me.FindForm
    8.     End Sub
    9.  
    10.     Private Sub _frm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles _frm.Paint
    11.         e.Graphics.DrawString("Drawn from the Extended SuperTextBox!", _frm.Font, New SolidBrush(Color.Red), 10, 10)
    12.     End Sub
    13.  
    14. End Class

    to test just replace one of the textboxes in your example with that one.
    Last edited by Edneeis; Oct 20th, 2003 at 12:06 PM.

  6. #6

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Yes, Edneesis, as usual, you have completely made what seemed like a big task seem trivial.

    That's the easy way I was looking for. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width