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.
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.
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.
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:
Public Class SuperTextBoxEx
Inherits SuperTextBox.SuperTextBox
Private WithEvents _frm As Form
Private Sub SuperTextBoxEx_ParentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ParentChanged
_frm = Me.FindForm
End Sub
Private Sub _frm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles _frm.Paint
e.Graphics.DrawString("Drawn from the Extended SuperTextBox!", _frm.Font, New SolidBrush(Color.Red), 10, 10)
End Sub
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.