wince: port win32 changes from rev 27386 #0d632cce9c

git-svn-id: trunk@28847 -
This commit is contained in:
blikblum 2010-12-31 10:18:00 +00:00
parent b27fe29d35
commit 9f15965b98
3 changed files with 15 additions and 10 deletions

View File

@ -546,7 +546,7 @@ Var
Parent: TWinControl;
Sibling: TControl;
WinControl: TWinControlAccess absolute Sibling;
PreviousCheckState: LRESULT;
LParamFlag: LRESULT;
i: Integer;
begin
Parent := RadioButton.Parent;
@ -557,9 +557,12 @@ Var
begin
// Pass previous state through LParam so the event handling can decide
// when to propagate LM_CHANGE (New State <> Previous State)
PreviousCheckState := Windows.SendMessage(WinControl.WindowHandle, BM_GETCHECK, 0, 0);
LParamFlag := Windows.SendMessage(WinControl.WindowHandle, BM_GETCHECK, 0, 0);
// Pass SKIP_LMCHANGE through LParam if previous state is already unchecked
if LParamFlag = BST_UNCHECKED then
LParamFlag := SKIP_LMCHANGE;
Windows.SendMessage(WinControl.WindowHandle, BM_SETCHECK,
Windows.WParam(BST_UNCHECKED), Windows.LParam(PreviousCheckState));
Windows.WParam(BST_UNCHECKED), Windows.LParam(LParamFlag));
end;
end;
end;
@ -1176,9 +1179,9 @@ begin
Flags := BST_INDETERMINATE
else
Flags := BST_CHECKED;
//pass a different values in WParam and WParam to force sending LM_CHANGE
//pass 0 through LParam to force sending LM_CHANGE
Windows.SendMessage(lWinControl.Handle, BM_SETCHECK,
Windows.WPARAM(Flags), Windows.LPARAM(Flags + 1));
Windows.WPARAM(Flags), 0);
end;
LMessage.Msg := LM_CLICKED;
end;
@ -2100,9 +2103,8 @@ begin
end;
BM_SETCHECK:
begin
//LParam holds previous state
//Propagate LM_CHANGED when state is changed
if LParam <> WParam then
//LParam holds BST_CHECKED, BST_UNCHECKED or SKIP_LMCHANGE;
if LParam <> SKIP_LMCHANGE then
LMessage.Msg := LM_CHANGED;
if lWinControl is TRadioButton then
begin

View File

@ -106,6 +106,9 @@ const
WM_LCL_SOCK_ASYNC = WM_USER;
//flag used to avoid propagating LM_CHANGE for TCustomCheckBox
SKIP_LMCHANGE = 1000;
type
{ Policy for using the "OK" close button in the title instead of

View File

@ -1330,8 +1330,8 @@ begin
else
Flags := Windows.WParam(BST_INDETERMINATE);
end;
//Pass the same state through lParam to avoid the OnChange event be fired
Windows.SendMessage(ACustomCheckBox.Handle, BM_SETCHECK, Flags, LPARAM(Flags));
//Pass SKIP_LMCHANGE through lParam to avoid the OnChange event be fired
Windows.SendMessage(ACustomCheckBox.Handle, BM_SETCHECK, Flags, SKIP_LMCHANGE);
end;
{ TWinCEWSToggleBox }