help with base.Text property

P

PeterB

I have a custom made form that works like a editable messagebox. It uses the
following override on the Text property of the form:

public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
lblFormTitle.Text = value;
}
}

I have a main form that creates the popup, the constructor takes a string
that is the name and I use a label to display the name as a caption bar.
(the form is borderless as it is not full-sized). The problem is that when I
set the name of the popup and call base.Text = name, in order to set the
actual this.Text value of the form, the main form is also renamed.

If I don't set the base.Text value this.Text is never set, is this a
problem? Is there a better solution to this?
 
P

Peter Foot [MVP]

I think this is a side-effect of the fact that the titlebar in Pocket PC is
not actually part of the window and it displays the caption of the currently
active form - therefore if you have a non-fullscreen form It'll display it's
caption and not that of the full screen form visible behind. The simplest
workaround would be to set the label from the constructor and not using the
Text property. Alternatively you could P/Invoke the SHSetNavBarText API
function and pass in the text of the parent form.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top