U613 specifying alignment in win32 and CE (from Yitzhak)
> The bug involved using the initalign (and related) indexes into > the array of alignments as indexes into the respective combo box, > and these are (apparently) not equivalent. To fix, the combo box > is queried one by one for the item with the index that produces > that proper alignment value, and then uses that index found. I > did not find an API that does this in one step, but this only > happens once, at dialog initialization.
This commit is contained in:
@@ -10,6 +10,7 @@ grammar, spelling and other typos
|
|||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
win32tty: fix visible CRLF characters during lockfile error message
|
win32tty: fix visible CRLF characters during lockfile error message
|
||||||
|
win32gui: you couldn't specify an alignment in defaults.nh and have it stick
|
||||||
|
|
||||||
|
|
||||||
General New Features
|
General New Features
|
||||||
|
|||||||
@@ -464,6 +464,20 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setComboBoxValue(HWND hWnd, int combo_box, int value)
|
||||||
|
{
|
||||||
|
int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
|
||||||
|
int index;
|
||||||
|
int value_to_set = LB_ERR;
|
||||||
|
for (index = 0; index < index_max; index++) {
|
||||||
|
if (SendDlgItemMessage(hWnd, combo_box, CB_GETITEMDATA, (WPARAM)index, 0) == value) {
|
||||||
|
value_to_set = index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SendDlgItemMessage(hWnd, combo_box, CB_SETCURSEL, (WPARAM)value_to_set, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize player selector dialog */
|
/* initialize player selector dialog */
|
||||||
void plselInitDialog(HWND hWnd)
|
void plselInitDialog(HWND hWnd)
|
||||||
{
|
{
|
||||||
@@ -497,7 +511,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_SETCURSEL, (WPARAM)flags.initrole, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_ROLE_LIST, flags.initrole);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intialize races list */
|
/* intialize races list */
|
||||||
@@ -507,7 +521,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_SETCURSEL, (WPARAM)flags.initrace, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_RACE_LIST, flags.initrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intialize genders list */
|
/* intialize genders list */
|
||||||
@@ -517,7 +531,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_SETCURSEL, (WPARAM)flags.initgend, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_GENDER_LIST, flags.initgend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intialize alignments list */
|
/* intialize alignments list */
|
||||||
@@ -527,7 +541,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_SETCURSEL, (WPARAM)flags.initalign, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_ALIGN_LIST, flags.initalign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -438,6 +438,20 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setComboBoxValue(HWND hWnd, int combo_box, int value)
|
||||||
|
{
|
||||||
|
int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
|
||||||
|
int index;
|
||||||
|
int value_to_set = LB_ERR;
|
||||||
|
for (index = 0; index < index_max; index++) {
|
||||||
|
if (SendDlgItemMessage(hWnd, combo_box, CB_GETITEMDATA, (WPARAM)index, 0) == value) {
|
||||||
|
value_to_set = index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SendDlgItemMessage(hWnd, combo_box, CB_SETCURSEL, (WPARAM)value_to_set, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize player selector dialog */
|
/* initialize player selector dialog */
|
||||||
void plselInitDialog(HWND hWnd)
|
void plselInitDialog(HWND hWnd)
|
||||||
{
|
{
|
||||||
@@ -471,7 +485,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_SETCURSEL, (WPARAM)flags.initrole, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_ROLE_LIST, flags.initrole);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intialize races list */
|
/* intialize races list */
|
||||||
@@ -481,7 +495,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_SETCURSEL, (WPARAM)flags.initrace, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_RACE_LIST, flags.initrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intialize genders list */
|
/* intialize genders list */
|
||||||
@@ -491,7 +505,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_SETCURSEL, (WPARAM)flags.initgend, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_GENDER_LIST, flags.initgend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* intialize alignments list */
|
/* intialize alignments list */
|
||||||
@@ -501,7 +515,7 @@ void plselInitDialog(HWND hWnd)
|
|||||||
} else {
|
} else {
|
||||||
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
|
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
|
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
|
||||||
SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_SETCURSEL, (WPARAM)flags.initalign, 0);
|
setComboBoxValue(hWnd, IDC_PLSEL_ALIGN_LIST, flags.initalign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user