From: <ah...@us...> - 2007-05-23 16:27:39
|
Revision: 11299 http://svn.sourceforge.net/jvcl/?rev=11299&view=rev Author: ahuser Date: 2007-05-23 09:27:35 -0700 (Wed, 23 May 2007) Log Message: ----------- Fixed abstract error when throwing an EAbort exception Modified Paths: -------------- trunk/jvcl/run/JvDBCombobox.pas trunk/jvcl/run/JvDatePickerEdit.pas Modified: trunk/jvcl/run/JvDBCombobox.pas =================================================================== --- trunk/jvcl/run/JvDBCombobox.pas 2007-05-21 18:42:46 UTC (rev 11298) +++ trunk/jvcl/run/JvDBCombobox.pas 2007-05-23 16:27:35 UTC (rev 11299) @@ -72,6 +72,7 @@ procedure DoExit; override; procedure Change; override; procedure Click; override; + procedure Reset; // This may cause trouble with BCB because it uses a HWND parameter // but as it is defined in the VCL itself, we can't do much. @@ -416,24 +417,45 @@ SendMessage(EditHandle, EM_SETREADONLY, Ord(not FDataLink.Editing), 0); end; +procedure TJvCustomDBComboBox.Reset; +begin + DataChange(Self); {Restore text} +end; + procedure TJvCustomDBComboBox.WndProc(var Msg: TMessage); begin if not (csDesigning in ComponentState) then case Msg.Msg of WM_COMMAND: if TWMCommand(Msg).NotifyCode = CBN_SELCHANGE then - if not FDataLink.Edit then - begin - if Style <> csSimple then - PostMessage(Handle, CB_SHOWDROPDOWN, 0, 0); - Exit; + begin + try + if not FDataLink.Edit then + begin + if Style <> csSimple then + PostMessage(Handle, CB_SHOWDROPDOWN, 0, 0); + Exit; + end + else + Reset; + except + Reset; + raise; end; + end; CB_SHOWDROPDOWN: if Msg.WParam <> 0 then - FDataLink.Edit + begin + try + FDataLink.Edit; + except + Reset; + raise; + end; + end else if not FDataLink.Editing then - DataChange(Self); {Restore text} + Reset; WM_CREATE, WM_WINDOWPOSCHANGED, CM_FONTCHANGED: FPaintControl.DestroyHandle; end; @@ -455,7 +477,7 @@ procedure TJvCustomDBComboBox.DoExit; begin - try + try FDataLink.UpdateRecord; except SelectAll; Modified: trunk/jvcl/run/JvDatePickerEdit.pas =================================================================== --- trunk/jvcl/run/JvDatePickerEdit.pas 2007-05-21 18:42:46 UTC (rev 11298) +++ trunk/jvcl/run/JvDatePickerEdit.pas 2007-05-23 16:27:35 UTC (rev 11299) @@ -489,21 +489,16 @@ if (NewDate <> Date) and EditCanModify then Date := NewDate; except - { If the EditCanModify method raises an exception the popup calendar is - destroyed in the modal message loop of the exception dialog and when - it returns we are still in the WM_LBUTTONUP handler of the now destroyed - calendar. - To prevent this the following code first disables the destruction of the - calendar, then shows the exception dialog and finally resumes the destruction - of the calendar. } - TJvDropCalendar(FPopup).CloseOnLeave := False; - TJvDropCalendar(FPopup).Hide; - {$IFDEF COMPILER5} - Application.HandleException(Self); - {$ELSE} - ApplicationHandleException(Self); - {$ENDIF COMPILER5} - TJvDropCalendar(FPopup).Release; + on E: Exception do + begin + { If the EditCanModify method raises an exception the popup calendar is + destroyed in the modal message loop of the exception dialog and when + it returns we are still in the WM_LBUTTONUP handler of the now destroyed + calendar. To prevent this the following code gracefully closes the popup + calendar. } + PopupCloseUp(Self, False); + raise; + end; end; end; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |