﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Enhancement Requests  » Controls w/option to have a default search message</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 05:29:13 GMT</lastBuildDate><ttl>20</ttl><item><title>Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25576.aspx</link><description>I really like web sites that have search boxes with the grayed out text message that clears when clicked in.  See attached images.  It seems that this would be a great feature for the StrataFrame-wrapped controls like the textbox, combobox, etc., especially in BrowseDialogs.  This would another little UI feature that would really help the product shine.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
Derek</description><pubDate>Thu, 21 Jan 2010 09:08:13 GMT</pubDate><dc:creator>Derek Price</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25594.aspx</link><description>Wow you guys are fast!  I was just pondering this idea yesterday and you've already implemented it.  Well done!  We've sub-classed many of the controls to add our own stuff as well.  It just seemed like a "wouldn't it be nice" feature for all StrataFrame users.  Now I have to find the time to see what you've done.&lt;br&gt;
&lt;br&gt;
Thanks again!&lt;br&gt;
Derek</description><pubDate>Thu, 21 Jan 2010 09:08:13 GMT</pubDate><dc:creator>Derek Price</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25588.aspx</link><description>I couldn't help myself. I had to try the OnPaint method. It wasn't easy. I just posted my test project in the user samples area:&lt;br&gt;
&lt;br&gt;
[url]http://forum.strataframe.net/FindPost25587.aspx[/url]&lt;br&gt;
&lt;br&gt;
It is kind of cool, but doesn't perform as well as I'd like.  It is a good example of how to do this sort of thing (and maybe why not to do it), so you might want to check it out.  This drawing stuff isn't easy....  :blink:</description><pubDate>Wed, 20 Jan 2010 19:58:44 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25583.aspx</link><description>I haven't tried this, so it might not work, but I'd actually look into overriding the OnPaint method.  If there is Text set, just do default (base.OnPaint), otherwise render the InitialText.  That way you wouldn't have to worry about handling accidentally saving the InitialText and you'd only have one method to override (rather than a set of events). I.e. this would more clearly separate the text that is initially shown vs. the Text that is bound.</description><pubDate>Wed, 20 Jan 2010 14:35:52 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25581.aspx</link><description>If the textbox is to be bound, make sure to strip that InitialText value from the Text property before saving.  There may be a way to overlay that initial text, too, rather than replace the Text property.  Just thinking out loud.  Les have given you a great start, though.  Have fun!!</description><pubDate>Wed, 20 Jan 2010 13:24:32 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25580.aspx</link><description>Hi Derek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The file MyControls.vb&amp;nbsp;listed below&amp;nbsp;is approximately how you could do it. I couldn't resist. Just&amp;nbsp;add it&amp;nbsp;to your project, then drop instances on your form, setting the +Pinter/InititalText property for each textbox to the prompt you want to see in each empty textbox. (I subclassed TextBox because I just got my laptop back from HP and haven't yet reinstalled SF, but this should give you a leg up.) Some of it, like the BackColor handling, is tentative and not really necessary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;----------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Imports System.Windows.Forms&lt;BR&gt;Imports System.ComponentModel&lt;/P&gt;&lt;P&gt;Public Class MyTextBox : Inherits TextBox&lt;/P&gt;&lt;P&gt;Private OriginalColor As Color&lt;/P&gt;&lt;P&gt;Private _InitialText As String = ""&lt;BR&gt;&amp;lt;Browsable(True), _&lt;BR&gt;&amp;nbsp;Bindable(True), _&lt;BR&gt;&amp;nbsp;Category("+Pinter"), _&lt;BR&gt;&amp;nbsp;DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)&amp;gt; _&lt;BR&gt;Public Property InitialText() As String&lt;BR&gt;&amp;nbsp;Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;Return _InitialText&lt;BR&gt;&amp;nbsp;End Get&lt;BR&gt;&amp;nbsp;Set(ByVal value As String)&lt;BR&gt;&amp;nbsp;&amp;nbsp;_InitialText = value&lt;BR&gt;&amp;nbsp;&amp;nbsp;Text = _InitialText&lt;BR&gt;&amp;nbsp;End Set&lt;BR&gt;End Property&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sub New()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;Font = New System.Drawing.Font("Courier New", _&lt;BR&gt;&amp;nbsp;&amp;nbsp; 9.0!, _&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Drawing.FontStyle.Regular, _&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Drawing.GraphicsUnit.Point, _&lt;BR&gt;&amp;nbsp;&amp;nbsp; CType(0, Byte))&lt;BR&gt;&amp;nbsp;&amp;nbsp; BackColor = Color.Ivory&lt;/P&gt;&lt;P&gt;&amp;nbsp;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;Private Sub MyTextBox_Enter( _&lt;BR&gt;&amp;nbsp; ByVal sender As Object, ByVal e As System.EventArgs) _&lt;BR&gt;&amp;nbsp; Handles Me.Enter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;BackColor = Color.White&lt;BR&gt;&amp;nbsp;&amp;nbsp;OriginalColor = ForeColor&lt;BR&gt;&amp;nbsp;&amp;nbsp;ForeColor = Color.Black&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;If InitialText IsNot Nothing Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Text.TrimEnd() = InitialText Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Text = ""&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;Private Sub MyTextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) _&lt;BR&gt;&amp;nbsp; Handles Me.Leave&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;If InitialText IsNot Nothing Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Text.TrimEnd() = "" Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Text = InitialText&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;BackColor = Color.Ivory&lt;BR&gt;&amp;nbsp;&amp;nbsp;ForeColor = OriginalColor&lt;/P&gt;&lt;P&gt;&amp;nbsp;End Sub&lt;/P&gt;&lt;P&gt;End Class&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Les</description><pubDate>Wed, 20 Jan 2010 13:19:18 GMT</pubDate><dc:creator>Les Pinter</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25578.aspx</link><description>Les Pinter has an article about subclassing SF controls (textbox) that might help further:&lt;/P&gt;&lt;P&gt;&lt;A href="http://lespinter.com/FoxToNet/ShowArticle.aspx?ArtNum=414"&gt;http://lespinter.com/FoxToNet/ShowArticle.aspx?ArtNum=414&lt;/A&gt;</description><pubDate>Wed, 20 Jan 2010 10:12:09 GMT</pubDate><dc:creator>Russell Scott Brown</dc:creator></item><item><title>RE: Controls w/option to have a default search message</title><link>http://forum.strataframe.net/FindPost25577.aspx</link><description>Hi Derek,&lt;br&gt;
&lt;br&gt;
The feature could be easily implemented by extending the SF TextBox control.  Simply add a property for the text that you want to display, then add some code to the get/lose focus events to manage the handling of the text for that property.  Look at some other posts about subclassed controls.  It is really not hard to do and you may find that other things you'd like implemented will be quite easy for you to handle.&lt;br&gt;
&lt;br&gt;
Have a great day!&lt;br&gt;
Bill</description><pubDate>Wed, 20 Jan 2010 09:41:17 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>