I'm PtFlush()ing, but it's not going down.

A user has entered a screenful of data. They hit a “GO” hit and now I’m
validating all of the data fields entered. When I process a field that is
not valid, I want to put the cursor back in that field and pop up a message
box. Even though I do a PtFlush(), the cursor isn’t going into the correct
field before the message box pops up.

Here is a sample of my code. What can I do to fix this?

double d;
char line[ 64 ];

d = atof( GetTextString( ABW_ConfigLubeInterval_txt ) );
if( d < 0 || d >= 2 )
{
PtGiveFocus( ABW_ConfigLubeInterval_txt, 0 );
PtFlush();
PtMessageBox( ABW_base, “Input Error”, “Must be between 0.0 and 1.999”, 0, 0 );
return( Pt_CONTINUE );
}
sprintf( line, “%f5.3”, d );
SetTextString( ABW_ConfigLateralFeedback_txt, line );
config_rec.lube_interval = int( d * 1000 );

P.S. GetTextString/SetTextString are just cover functions for
Pt[G|S]etResources().

Bill Caroselli <qtps@earthlink.net> wrote:

BC > A user has entered a screenful of data. They hit a “GO” button and now I’m
BC > validating all of the data fields entered. When I process a field that is
BC > not valid, I want to put the cursor back in that field and pop up a message
BC > box. Even though I do a PtFlush(), the cursor isn’t going into the correct
BC > field before the message box pops up.

BC > Here is a sample of my code. What can I do to fix this?

BC > double d;
BC > char line[ 64 ];

BC > d = atof( GetTextString( ABW_ConfigLubeInterval_txt ) );
BC > if( d < 0 || d >= 2 )
BC > {
BC > PtGiveFocus( ABW_ConfigLubeInterval_txt, 0 );
BC > PtFlush();
BC > PtMessageBox( ABW_base, “Input Error”, “Must be between 0.0 and 1.999”, 0, 0 );
BC > return( Pt_CONTINUE );
BC > }
BC > sprintf( line, “%f5.3”, d );
BC > SetTextString( ABW_ConfigLateralFeedback_txt, line );
BC > config_rec.lube_interval = int( d * 1000 );

BC > P.S. GetTextString/SetTextString are just cover functions for
BC > Pt[G|S]etResources().

Anyone got any ideas why my cursor isn’t moving until AFTER I dismiss
the message box?

Bill Caroselli wrote:

BC > P.S. GetTextString/SetTextString are just cover functions for
BC > Pt[G|S]etResources().

Anyone got any ideas why my cursor isn’t moving until AFTER I dismiss
the message box?

What if you put up the message box first, then change the focus?
I would think the message box would have focus since you
put it up…

I prefer a message area somewhere myself…
Otherwise it just a wasted click & move. YMMV though

acellarius-eventhisNGisharvested!@yahood.ott.com wrote:


aeyoc > Bill Caroselli wrote:

BC > P.S. GetTextString/SetTextString are just cover functions for
BC > Pt[G|S]etResources().

Anyone got any ideas why my cursor isn’t moving until AFTER I dismiss
the message box?

aeyoc > What if you put up the message box first, then change the focus?
aeyoc > I would think the message box would have focus since you
aeyoc > put it up…

aeyoc > I prefer a message area somewhere myself…
aeyoc > Otherwise it just a wasted click & move. YMMV though

Well, it made good sense, but it didn’t work. Thanks for trying.

I guess the problem is that if there is a window in front (I.E. the
message box window) of my window, then no object in my window can show
a cursor.

Bill Caroselli wrote:

Well, it made good sense, but it didn’t work. Thanks for trying.

I guess the problem is that if there is a window in front (I.E. the
message box window) of my window, then no object in my window can show
a cursor.

No, that makes sense. But once you dismiss the msg box, does
the widget not get the focus? I would have expected it to.

I suppose you will have to make use of an additional
lost focus callback to give focus to the wrong
box.

Hi Bill…

‘I’m PtFlush()ing, but it’s not going down’

You know, it happens! :slight_smile:

Regards…

Miguel.


Bill Caroselli wrote:

A user has entered a screenful of data. They hit a “GO” hit and now I’m
validating all of the data fields entered. When I process a field that is
not valid, I want to put the cursor back in that field and pop up a message
box. Even though I do a PtFlush(), the cursor isn’t going into the correct
field before the message box pops up.

Here is a sample of my code. What can I do to fix this?

double d;
char line[ 64 ];

d = atof( GetTextString( ABW_ConfigLubeInterval_txt ) );
if( d < 0 || d >= 2 )
{
PtGiveFocus( ABW_ConfigLubeInterval_txt, 0 );
PtFlush();
PtMessageBox( ABW_base, “Input Error”, “Must be between 0.0 and 1.999”, 0, 0 );
return( Pt_CONTINUE );
}
sprintf( line, “%f5.3”, d );
SetTextString( ABW_ConfigLateralFeedback_txt, line );
config_rec.lube_interval = int( d * 1000 );

P.S. GetTextString/SetTextString are just cover functions for
Pt[G|S]etResources().

acellarius-eventhisNGisharvested!@yahood.ott.com wrote:
aeyoc > Bill Caroselli wrote:

Well, it made good sense, but it didn’t work. Thanks for trying.

I guess the problem is that if there is a window in front (I.E. the
message box window) of my window, then no object in my window can show
a cursor.

aeyoc > No, that makes sense. But once you dismiss the msg box, does
aeyoc > the widget not get the focus? I would have expected it to.

aeyoc > I suppose you will have to make use of an additional
aeyoc > lost focus callback to give focus to the wrong
aeyoc > box.

The hope was that while the message box was still visible on the screen, in
front of the main window, that the main window would show a cursor in the
offending field.

But, it seams that if the message box is in front on the main window, then
IT had focus, so nothing on the main window can have focus render ability.

Bill Caroselli wrote:

acellarius-eventhisNGisharvested!@yahood.ott.com wrote:
aeyoc > Bill Caroselli wrote:

Well, it made good sense, but it didn’t work. Thanks for trying.

I guess the problem is that if there is a window in front (I.E. the
message box window) of my window, then no object in my window can show
a cursor.


aeyoc > No, that makes sense. But once you dismiss the msg box, does
aeyoc > the widget not get the focus? I would have expected it to.

aeyoc > I suppose you will have to make use of an additional
aeyoc > lost focus callback to give focus to the wrong
aeyoc > box.

The hope was that while the message box was still visible on the screen, in
front of the main window, that the main window would show a cursor in the
offending field.

But, it seams that if the message box is in front on the main window, then
IT had focus, so nothing on the main window can have focus render ability.

What you are saing is 100% correct. If you bring up a message box then
it has focus and the main window won’t. Can you outline areas with a a
red rectangle or maybe change the background color of the offending fields?

Thanks,
Rodney