Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » erratic response to Text.setFocus
erratic response to Text.setFocus [message #282693] Thu, 17 March 2005 15:12 Go to next message
Eclipse UserFriend
Originally posted by: cervezas.no-spam-pikesoft.com

I have a Master-Details style FormEditor that opens different kind of
DetailsPages depending on which object is selected in the Table of my
MasterPart. (These details may not be relevant, but I provide them just in
case.) My problem is that when I change the selection and update the
DetailsPage I want to have the focus go to the first widget on the form,
which in each case happens to be a Text widget. Simple enough: I add a call
to myText.setfocus to the update() method of each of my DetailsPages and
make sure it gets called when selectionChanged() is called. And this
works... sometimes.

I've verified that setfocus() is being called every time I want it to, but
it only actually sets the focus in that widget about half the time. I
haven't been able to detect a pattern for when it succeeds and fails, but it
seems like it always succeeds the first time it is called on a particular
Text widget and starts to get flaky only on subsequent calls.

Very strange, and problematic since this application is designed to allow
quick data entry. Any clues to what might be happening?

David
Re: erratic response to Text.setFocus [message #282731 is a reply to message #282693] Fri, 18 March 2005 09:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi David,

1. Which platform(s) do you see or not see this problem on?

2. In the cases where focus does not get into the Text, where does focus end
up? Is it left on the previous focus widget, or does it seemingly
disappear, or go somewhere random?

3. Does async'ing your setFocus() call help? ie.-
text.getDisplay().asyncExec(new Runnable() {
public void run() {
text.setFocus();
}
});

Grant

"David Beers" <cervezas@no-spam-pikesoft.com> wrote in message
news:d1cocd$opo$1@www.eclipse.org...
> I have a Master-Details style FormEditor that opens different kind of
> DetailsPages depending on which object is selected in the Table of my
> MasterPart. (These details may not be relevant, but I provide them just
in
> case.) My problem is that when I change the selection and update the
> DetailsPage I want to have the focus go to the first widget on the form,
> which in each case happens to be a Text widget. Simple enough: I add a
call
> to myText.setfocus to the update() method of each of my DetailsPages and
> make sure it gets called when selectionChanged() is called. And this
> works... sometimes.
>
> I've verified that setfocus() is being called every time I want it to, but
> it only actually sets the focus in that widget about half the time. I
> haven't been able to detect a pattern for when it succeeds and fails, but
it
> seems like it always succeeds the first time it is called on a particular
> Text widget and starts to get flaky only on subsequent calls.
>
> Very strange, and problematic since this application is designed to allow
> quick data entry. Any clues to what might be happening?
>
> David
>
>
Re: erratic response to Text.setFocus [message #282934 is a reply to message #282731] Wed, 23 March 2005 20:41 Go to previous message
Eclipse UserFriend
Originally posted by: cervezas.no-spam-pikesoft.com

Yep, asynching fixed the problem.

Thanks, Grant!

"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d1en8f$5hb$1@www.eclipse.org...
> Hi David,
>
> 1. Which platform(s) do you see or not see this problem on?
>
> 2. In the cases where focus does not get into the Text, where does focus
end
> up? Is it left on the previous focus widget, or does it seemingly
> disappear, or go somewhere random?
>
> 3. Does async'ing your setFocus() call help? ie.-
> text.getDisplay().asyncExec(new Runnable() {
> public void run() {
> text.setFocus();
> }
> });
>
> Grant
>
> "David Beers" <cervezas@no-spam-pikesoft.com> wrote in message
> news:d1cocd$opo$1@www.eclipse.org...
> > I have a Master-Details style FormEditor that opens different kind of
> > DetailsPages depending on which object is selected in the Table of my
> > MasterPart. (These details may not be relevant, but I provide them just
> in
> > case.) My problem is that when I change the selection and update the
> > DetailsPage I want to have the focus go to the first widget on the form,
> > which in each case happens to be a Text widget. Simple enough: I add a
> call
> > to myText.setfocus to the update() method of each of my DetailsPages and
> > make sure it gets called when selectionChanged() is called. And this
> > works... sometimes.
> >
> > I've verified that setfocus() is being called every time I want it to,
but
> > it only actually sets the focus in that widget about half the time. I
> > haven't been able to detect a pattern for when it succeeds and fails,
but
> it
> > seems like it always succeeds the first time it is called on a
particular
> > Text widget and starts to get flaky only on subsequent calls.
> >
> > Very strange, and problematic since this application is designed to
allow
> > quick data entry. Any clues to what might be happening?
> >
> > David
> >
> >
>
>
Previous Topic:ActiveX Control License File
Next Topic:Manifest file editing for library plug-ins
Goto Forum:
  


Current Time: Sat Sep 13 17:04:16 EDT 2025

Powered by FUDForum. Page generated in 0.03167 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top