Thanks, Mark. I've located the problem.  I was trying to set focus on the
button and then set the text cursor in an edit control. The code was:

    pbSaveChanges]~state = "FOCUS"     -- the push button
    self~focusControl("IDC_PROD_NAME") -- the edit control

Doh!

I changed the the second statement to:

    self~tabToNext()

and it all worked fine (the next control was the one I wanted the text
cursor on).

Thx,
Oliver

 

-----Original Message-----
From: Mark Miesfeld [mailto:[email protected]] 
Sent: 17 July 2011 16:44
To: Open Object Rexx Users
Subject: Re: [Oorexx-users] Control does not get focus

On Sat, Jul 16, 2011 at 11:46 AM,  <[email protected]> wrote:

> In my ProductView ResDialog (attached), the following statement is 
> issued in the UpdateProduct method:
>
> prodControls[pbSaveChanges]~state = "FOCUS"
>
> This is intended to make the "Save Changes" pushbutton the default 
> when the user presses enter. But this doesn't happen.

The operating system uses what is referred to as the dialog manager to
control how dialogs behave.  Part of what it does it determine what the
'default' push button is at any time.  You are proably working at cross
purpose to the dialog manager.

I haven't looked at your program, but you probaly need to set the style to
"DEFAULT" and set the focus.  Something like this:

prodControls[pbSaveChanges]~style = "DEFAULT"
prodControls[pbSaveChanges]~state = "FOCUS"

Part of the problem is the implementation of ooDialog.  Rather than using
set focus to move the focus in you should use the WM_NEXTDLGCTL message.
But, ooDialog doesn't expose that anywhere.  Something that should be added.

Setting the focus directly bypasses the dialog manager.  Using WM_NEXTDLGCTL
goes through the dialog manager.

Also, it could be you are not assigning a DEFAULT button when you create
your dialog.  If the Save Changes button is always the one that should be
activated when the user hits Enter, just make it the default button from
your resource editor.

> I use the same approach for CustomerView (an RcDialog), and it works fine.

It could be that in the program there is no button with the DEFAULT style.
In which case, the button with the focus will be the button pushed when
Enter is hit.

--
Mark Miesfeld

----------------------------------------------------------------------------
--
AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries,
the creator of the Lean Startup Methodology on "Lean Startup Secrets
Revealed." This video shows you how to validate your ideas, optimize your
ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users



------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to