FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How do I ... ?
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
How do I ... ?
Posted: Tue Sep 14, 2010 01:44 PM

Guys:

On a dialog with a couple of says & gets, how can I:
1. Highlight in other color the current get ?
2. Move between fields with the ENTER key instead of the TAB key ?

Thank you.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 02:22 PM
Hello Hunter,



REDEFINE GET oGet1 VAR SOURCETEXT1 ID 100 OF oDlg UPDATE
oGet1:bGotFocus := {|| oGet1:SetColor( 16777215, 128 ) }
oGet1:bLostFocus := {|| oGet1:SetColor( 0, ) }

REDEFINE GET oGet2 VAR SOURCETEXT2 ID 101 OF oDlg UPDATE
oGet2:bGotFocus := {|| oGet2:SetColor( 16777215, 128 ) }
oGet2:bLostFocus := {|| oGet2:SetColor( 0, ) }


The Get-Fields inside the Resource, must be sorted to running Numbers.
A Return on a Focused Get, will move to the next one.



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 02:27 PM

Uwe:

I'm not using resources, will it work ? Thank you very much my friend. 8)

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 02:41 PM
Code (fw): Select all Collapse
  if oDialog:oCtlFocus == oGet[1]
      if nKey = VK_RETURN
         oGt[1]:oWnd:GoNextCtrl(oGt[1]:hWnd)
      end
   end
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 02:43 PM
HunterEC wrote:Guys:

On a dialog with a couple of says & gets, how can I:
1. Highlight in other color the current get ?
Thank you.


Use this function to Highlight color of current get:
Code (fw): Select all Collapse
SetGetColorFocus( nClrFocus )


nClrFocus parameter is optional and defaults to RGB( 235, 235, 145 )
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 02:57 PM
HunterEC wrote:Guys:

On a dialog with a couple of says & gets, how can I:
2. Move between fields with the ENTER key instead of the TAB key ?

Thank you.

We do not have to write any code for this. By default pressing either ENTER key or TAB key moves to the next field.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 03:21 PM
I tested :

SetGetColorFocus( nClrFocus )

the first Time, but why it doesn't work with Multiline-Get ?

Added SetGetColorFocus( 16577214 ) on Top of the Application



That Works with Multiline Get
// ------ Font - Source + Color ----------------------
REDEFINE GET oGet2 VAR SOURCETEXT ID 530 OF oDlg MULTILINE UPDATE
oGet2:bGotFocus := {|| oGet2:SetColor( 0, 16577214 ) }
oGet2:bLostFocus := {|| oGet2:SetColor( 0, ) }


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How do I ... ?
Posted: Tue Sep 14, 2010 03:45 PM
I tested :

SetGetColorFocus( nClrFocus )

the first Time, but why it doesn't work with Multiline-Get ?


SetGetColorFocus( nClrFocus ) is available in FWH from October 2007.
This is intended for normal Gets only, not multi-line gets.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How do I ... ?
Posted: Wed Sep 15, 2010 10:40 PM
We do not have to write any code for this. By default pressing either ENTER key or TAB key moves to the next field.


I don't believe this is true. If there is a default pushbutton, then that pushbutton is activated when the Enter key is pressed. This is standard Windows behavior, and I don't think it is a good idea to deviate from this standard. Users expect dialogs to work this way. Using the Enter key for field movement is a holdover from the Clipper apps era and should be abandoned (IMHO).

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How do I ... ?
Posted: Thu Sep 16, 2010 03:34 AM
If there is a default pushbutton, then that pushbutton is activated when the Enter key is pressed.

Yes. But when a dialog and gets are written in source code (not resources) there is no default button unless specifically coded with DEFAULT clause. So, if the programmer wants Enter key to navigate to the next get, he better does not provide for a DEFAULT button.

I don't believe this is true.

But this is true. I presume the FWH code is written that way to accommodate those programmers who insist on the old DOS behavior on windows applications too. The behavior of FWH is that Enter key invokes DEFAULT pushbutton if it is there and otherwise navigates to the next control.
This is standard Windows behavior, and I don't think it is a good idea to deviate from this standard. Users expect dialogs to work this way. Using the Enter key for field movement is a holdover from the Clipper apps era and should be abandoned (IMHO).

While I personally agree with you totally, we see here many programmers who insist on behavior compatible with legacy DOS applications. It is understandable that FWH caters to the needs of all programmers.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How do I ... ?
Posted: Thu Sep 16, 2010 05:53 AM

Rao,

I meant that it is not true whenever there is a default pushbutton. And there is a default pushbutton (by default) whenever a new dialog is designed in Workshop. It is extremely tedious to write code for dialogs, so I am not sure why anyone would choose to do that over visually designing them. Perhaps because they do not know that they can visually design them.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion