On Mon, 3 May 2010 14:52:30 +0300 Juha Manninen <[email protected]> wrote:
> Hi > > I have been converting EssModel Delphi program, partly as an exercise and > partly because it could develop into a useful program or component. > It is a reverse engineering class diagram tool. > > I am facing more problems than expected. This is not related to Delphi > converter in Lazarus but to the manual editing after it. > > First, the code uses a trick. It typecast controls like TForm to a local > TCrackControl just to reach the protected TControl.OnMouseDown and such. > > type > TCrackControl = class(TControl); // <-- empty local class > var > found: TControl; > cc: TCrackControl; > > and later: > // 'found' can be TForm or anything. > cc:=TCrackControl(found); // <-- error > cc.OnMouseDown := ... > > It gives 'RunError(219)', and the whole Lazarus may become unstable. > The typecast is actually OK because the controls inherit from TControl and > OnMouseDown is defined there. According to Mattias this system is even used > in > Lazarus itself. In a small test project the same system worked for me, too. > ??? > > The program used interfaces heavily, actually in a clever way. I thought they > cause the above problem and changed the code quite much to get rid of > interfaces. No difference, it still doesn't work. > > Next problem: I noticed there are TActions defined in a DataModule which is > created in MainForm.OnActivate handler, and the actions are used in form's > menu and button. I thought it causes problems and I copied everything from > DataModule to MainForm. I set the actions carefully like they were before and > now menu items work but open-button does not. The exact same action is > triggered by menuitem but not by button! > So, this refactoring didn't solve any problems but created a new one. Did you notice that there are two OpenButton? One has the action, the other not. Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
