SIP vs Second Form & TextBox

G

Guest

Nearly all the guys in my team found a problem

If an assembly contains more than one instance of SIP in different forms, when you hit a textbox in a non-mainform when the SIP is enabled, the textbox will got focus but you can't type anything on it. This situation happens on both the TextBox and TextBox in a DataGrid. You need to hit the screen again to get the "real focus"

By further study with it, I found that if the pen press the display a little longer or make the pen move in the textbox, the problem will not come out. As you can't require your customer to "press the textbox a little longer" because it seems ridiculous, I tried many ways to solve it but all failed

First, I supposed that the TextBox doesn't get the focus really and I add the .Focus() in textbox_getfocus event, but it doesn't work

Then I supposed that maybe the Form doesn't get the focus and I add the this.Focus() ... failed again, even failed when I set the focus to another form before this.focus()

Finally I try to make the instances of SIP in different Forms disposed before showing another form and making a new instance of SIP in that form ... failed like before

As I need to get the size of visible desktop without sip, I can't just use SipShowIM API. If there is a way to work out the problem in pure .NET code

The following is a simple sample of my source code in the second form

private void sip_EnabledChanged(...

redock(); // This function is to make the current TextBox visible by moving it in vertical way
// There is only codes of .left = xxx and VScrollBar.Visible = xx


private void tb_GotFocus(...

checkInput(); // This function is to check whether the input with the current "node"
//(like datetime in a datetimePicker control) is validate, and copy the context in the "node" objec

nodeEnabled = false; // Make the forecolor of labels, textbox and datetimePicker with the current "node"
// from Red to Black
i = arrTxt.IndexOf(sender); // Get the index of the "new" current "node
i++; // Fix the inde
currentNode = oc; // set the current nod
nodeEnabled = true; // Turn black to Re

if (sip.Enabled == false) sip.Enabled = true


Any suggests?
 
J

Jan Yeh

Hello,

I've encountered the same "No real focus" situation before,
but not the same way to induce it.

I use a ListView as a menu to show sub forms, and sometimes
when user clicks the ListView and the sub form will show,
but the toolbar and the title still remain as menu form's.
And it's another kind of "No real focus" situation, user have to
click the form again to get real focus.

When I trace the code step by step , I found that the callstack is
[ListView_ItemClick] - [SubForm_Load], and after subform.Show()
is done, the code will back to ListView_ItemClick, and keep the
focus in the menu form.

I also tried .focus() to solve this problem, but failed as you.

--
Best Regards,
Jan Yeh

..NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan

Sumtec said:
Nearly all the guys in my team found a problem:

If an assembly contains more than one instance of SIP in different forms,
when you hit a textbox in a non-mainform when the SIP is enabled, the
textbox will got focus but you can't type anything on it. This situation
happens on both the TextBox and TextBox in a DataGrid. You need to hit the
screen again to get the "real focus".
By further study with it, I found that if the pen press the display a
little longer or make the pen move in the textbox, the problem will not come
out. As you can't require your customer to "press the textbox a little
longer" because it seems ridiculous, I tried many ways to solve it but all
failed.
First, I supposed that the TextBox doesn't get the focus really and I add
the .Focus() in textbox_getfocus event, but it doesn't work.
Then I supposed that maybe the Form doesn't get the focus and I add the
this.Focus() ... failed again, even failed when I set the focus to another
form before this.focus().
Finally I try to make the instances of SIP in different Forms disposed
before showing another form and making a new instance of SIP in that form
.... failed like before.
As I need to get the size of visible desktop without sip, I can't just use
SipShowIM API. If there is a way to work out the problem in pure .NET code?
The following is a simple sample of my source code in the second form:

private void sip_EnabledChanged(...)
{
redock(); // This function is to make the current TextBox visible by moving it in vertical way.
// There is only codes of .left = xxx and VScrollBar.Visible = xxx
}

private void tb_GotFocus(...)
{
checkInput(); // This function is to check whether the input with the current "node"
//(like datetime in a datetimePicker control) is
validate, and copy the context in the "node" object
nodeEnabled = false; // Make the forecolor of labels, textbox and
datetimePicker with the current "node"
// from Red to Black.
i = arrTxt.IndexOf(sender); // Get the index of the "new" current "node"
i++; // Fix the index
currentNode = oc; // set the current node
nodeEnabled = true; // Turn black to Red

if (sip.Enabled == false) sip.Enabled = true;
}

Any suggests?
 
S

Srivani Eluri

Which binaries are you using? We have seen the problem on the RTM version
of netcf ? Are you seeing it on SP1?


This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jan Yeh

Yes. It's .NETcf 1.0 SP1 ...

I thought that I should not use ListView control as a menu...
;)

--
Best Regards,
Jan Yeh

MCP, .NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan

"Srivani Eluri" <"srivan"@microsoft ¦b¶l¥ó
¤¤¼¶¼g...
 

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