TCombobox DROPDOWN style and VK_RETURN

TCombobox DROPDOWN style and VK_RETURN

Postby frose » Tue Jun 29, 2010 11:28 am

Hi,

when the focus is on a Combobox in DROPDOWN style, the RETURN-key doesn't trigger the default pushbutton (IDOK = 1).

Is this a bug or a feature? Is there a workaround to switch to default behavior?

See also sample: samples\combos.prg
Old topic: viewtopic.php?f=3&t=11342
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: TCombobox DROPDOWN style and VK_RETURN

Postby frose » Sun Jul 04, 2010 2:14 pm

Any comment or tip?
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: TCombobox DROPDOWN style and VK_RETURN

Postby James Bott » Sun Jul 04, 2010 5:17 pm

Frose,

Is this a bug or a feature? Is there a workaround to switch to default behavior?


This is standard Windows behavior. Right click on the Windows desktop, select Properties, then the Appearance tab, then try one of the comboboxes. You will see that it acts the same--the Enter key selects the current item, not the default pushbutton.

Changing your application from default Windows behavior will confuse and probably make users unhappy (even if the change does seem better than the default).

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TCombobox DROPDOWN style and VK_RETURN

Postby frose » Mon Jul 05, 2010 7:04 am

James,

thank you for answering.

Understanding that there are two subtypes of comboboxes:

DROPDOWNLIST: The user can chose only available list entries. I think you are refering to this type and I agree with you

DROPDOWN: The user can edit the list entry. Didn't found this type in the desktop properties, but e. g. all search fields in Firefox or UEStudio, etc. are using this type. Here FWH differ from standard Windows behavior!

This issue was discussed here viewtopic.php?f=3&t=11342 in 2008 and you have made this proposal:
RE: Return Key Behavior

Another issue I have with the newer TCombobox class is that now the return key acts like the tab key--either will move to the next control. I know lots of programmers from the DOS era still want their apps to move from control to control using the Return key, but this is not standard Windows app behavior. Only the Tab key should do this. The Return key should trigger the default pushbutton (usually the OK button). Since the use of the Return key is now hardcoded into the TCombobox class, if a combobox has focus and the user presses the Return key, the focus will just move to the next control--not trigger the default pushbutton. To make things more confusing when the next control (not a combobox) is in focus then the Return key WILL trigger the default pushbutton.

I suggest that the use of the Return key in TCombobox should be optional and should default to off (lWantReturn := .f. ).

Seems to me that your proposal is unrealised until now :(
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: TCombobox DROPDOWN style and VK_RETURN

Postby James Bott » Mon Jul 05, 2010 5:30 pm

Frank,

I think I should clarify what I said.

The Return key should trigger the default pushbutton when the combobox is NOT showing the dropdown list. Otherwise, when the list is showing, the Return key should select the currently highlighted item. Again this is how the Windows desktop properties app works.

I have not tested a current version of FW's combobox with a DROPDOWN style. Is it not working this way? Do you have a small test sample code?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TCombobox DROPDOWN style and VK_RETURN

Postby frose » Tue Jul 06, 2010 10:35 am

James,

I've tested with samples\combos.prg and experienced the old DOS behavior
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: TCombobox DROPDOWN style and VK_RETURN

Postby frose » Fri Nov 05, 2010 6:44 am

nothing changed in FWH 1010!
It's still old DOS behaviour -> VK_RETURN jumps to the next dialog field :(
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: TCombobox DROPDOWN style and VK_RETURN

Postby frose » Sat Nov 06, 2010 4:32 pm

James,

can you confirm the old DOS behaviour or am I wrong?

You can find a combo box with this style in the sample combos.prg, there it is the middle one:

Image
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: TCombobox DROPDOWN style and VK_RETURN

Postby James Bott » Sat Nov 06, 2010 5:46 pm

Frank,

Yes, I confirm that is what happens with that example, however, the button is not defined as the default pushbutton in the RC file, nor is it REDEFINEd in the PRG. So, I am not sure this is a good example.

I suggest building a test PRG (as simple as possible) showing the problem.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TCombobox DROPDOWN style and VK_RETURN

Postby frose » Sat Nov 06, 2010 6:56 pm

James,

here it is:
Code: Select all  Expand view
#include "FiveWin.ch"

// ComboBox Styles

#define CBS_SIMPLE               1  // 0x0001
#define CBS_DROPDOWN             2  // 0x0002
#define CBS_DROPDOWNLIST         3  // 0x0003
#define CBS_OWNERDRAWFIXED      16  // 0x0010
#define CBS_AUTOHSCROLL         64  // 0x0040
#define CBS_OEMCONVERT         128  // 0x0080
#define CBS_SORT               256  // 0x0100
#define CBS_DISABLENOSCROLL   2048  // 0x0800

FUNCTION main()

   LOCAL oDlg, oCombo, cCombo := "DOS"
     
   DEFINE DIALOG oDlg TITLE "TCombobox DROPDOWN style and VK_RETURN" FROM 10, 10 TO 25, 75

   @ 1, 1 COMBOBOX oCombo Var cCombo ITEMS { "1", "2", "3" } SIZE 40, 120 STYLE CBS_DROPDOWN
   
   @ 5, 1 BUTTON oBtn PROMPT "Ok" OF oDlg Default ACTION( oDlg:End() )

   ACTIVATE DIALOG oDlg CENTERED
   
RETURN NIL
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests