From: <ah...@us...> - 2009-10-02 09:36:59
|
Revision: 12535 http://jvcl.svn.sourceforge.net/jvcl/?rev=12535&view=rev Author: ahuser Date: 2009-10-02 09:36:42 +0000 (Fri, 02 Oct 2009) Log Message: ----------- Mantis 4932: Bad selection in Designer with default messenger class Modified Paths: -------------- trunk/jvcl/run/JvDesignSurface.pas trunk/jvcl/run/JvDesignUtils.pas Modified: trunk/jvcl/run/JvDesignSurface.pas =================================================================== --- trunk/jvcl/run/JvDesignSurface.pas 2009-10-02 09:20:57 UTC (rev 12534) +++ trunk/jvcl/run/JvDesignSurface.pas 2009-10-02 09:36:42 UTC (rev 12535) @@ -1128,4 +1128,4 @@ UnregisterUnitVersion(HInstance); {$ENDIF UNITVERSIONING} -end. \ No newline at end of file +end. Modified: trunk/jvcl/run/JvDesignUtils.pas =================================================================== --- trunk/jvcl/run/JvDesignUtils.pas 2009-10-02 09:20:57 UTC (rev 12534) +++ trunk/jvcl/run/JvDesignUtils.pas 2009-10-02 09:36:42 UTC (rev 12535) @@ -276,24 +276,37 @@ end; end; +type + TAccessComponent = class(TComponent); + function DesignLoadComponentFromStream(AComp: TComponent; AStream: TStream; AOnError: TReaderError): TComponent; var - MS: TMemoryStream; + MemStream: TMemoryStream; + CompDesigning: Boolean; begin - MS := TMemoryStream.Create; + MemStream := TMemoryStream.Create; try - ObjectTextToBinary(AStream, MS); - MS.Position := 0; - with TReader.Create(MS, 4096) do + ObjectTextToBinary(AStream, MemStream); + MemStream.Position := 0; + with TReader.Create(MemStream, 4096) do try OnError := AOnError; - Result := ReadRootComponent(AComp); + { We have to set the container into design mode so all loaded components + are in design mode. } + CompDesigning := csDesigning in AComp.ComponentState; + TAccessComponent(AComp).SetDesigning(True, False); + try + Result := ReadRootComponent(AComp); + finally + if not CompDesigning then + TAccessComponent(AComp).SetDesigning(CompDesigning, False); + end; finally Free; end; finally - MS.Free; + MemStream.Free; end; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |