Focus issue?



Hi All,

I have an application that has a list box of items to be selected, plus an
Edit and Add buttons. On both the buttons, they will use DialogBoxParam to
pop up their respective dialog box. The only difference between the two are
the former dialog box displays treeobjects and the lattar is just a simple
dialog box.

However, the strange thing is that if I NEWLY select an item from the list
box, I will need to click the Edit button twice before its dialog box will
appear, wheras on the Add button, I only need to click it once. If I stay
with the same list item, and click on the Edit button, its dialog box will
then appear right away.

Is this something to do with focus issue? I tried to change focus to the
Edit button after a list item is selected to no avail.

I compared the dialog property for both the dialogs and they are not much
difference.

I hope someone could shed some light here, TIA.

Here are the properties:

IDD_LISTVIEW DIALOG DISCARDABLE 0, 0, 130, 140
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE 0x80000000L
BEGIN
LTEXT "General Settings:",IDC_STATIC,1,2,123,8
CONTROL "ListView",IDC_PRESET_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,14,128,98
PUSHBUTTON "&Edit",IDC_EDITBUTTON,1,114,30,100
PUSHBUTTON "&Add",IDC_ADDBUTTON,32,114,24,100
END


The Add properties:

IDD_TEXT DIALOG DISCARDABLE 0, 0, 129, 70
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE 0x80000000L
BEGIN
LTEXT "Enter new text:",IDC_NUMBER_LIMIT,2,22,110, 10
EDITTEXT IDC_TEXT_NAME_DATA,10,33,112,12,ES_AUTOHSCROLL
END

The Edit properties:
IDD_LIST_ITEM DIALOG DISCARDABLE 0, 0, 132, 140
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE 0x80000000L
BEGIN
LTEXT "Item:",IDC_STATIC,3,3,24,9
CONTROL "Tree1",IDC_ITEM_TREE,"SysTreeView32",TVS_HASBUTTONS |
TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP |
TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,5,16,118,89
END


.