Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-11

Custom LCL components still bugging me

21 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Tony Maro wrote 9 lines
Wow, that's it... I've learned more about how Lazarus creates forms than I ever wanted to. ;-) When you add this unit to the form, for some reason the form sets visible := True explicitly declared in the .lfm (and .lrs of course) If I add the esdsound unit and EXPLICITLY set the visible property of the form to false in the designer, the problem does not occur.

I REALLY feel like I'm carrying on a conversation with myself now... sorry I didn't shove all this info into one mail, BUT, thought you'd need like to know that every time I open the project the frmmain.visible property is set back to visible. As long as I set that property to false before I build, the application runs. If I don't the frmmain variable is invalid when the app runs.

Now, I KNOW that property probably should be true, but maybe this info will help you guys get closer to the root of the problem...

-Tony

Reply by email

Mattias Gaertner
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Show quoted text 20 lines
On Thu, 2002-11-14 at 11:24, Mattias Gaertner wrote: > On 14 Nov 2002 11:25:55 -0500 > andrew johnson wrote: > > > well.. first things first.. realocmem can have unpredictable results > > on an uninitialized block.. since this is uninitialized it might be > > contributing to the problem. You should instead init it with > > SoundFiles:= nil; > > TObject properties are auto initialized before the constructor is > called. > > I replayed Tony's description and found a bug in the find declaration. > This bug might also be the one, that Danie described (OI events). I thought since that was simply a pointer anyway that I shouldn't need to worry about it. But, I tried Andrew's suggestion anyway and it didn't make a difference. Does this mean you fixed it in CVS?

Yes.
Does it solve your problem?

Mattias

Reply by email

Tony Maro
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…
Mattias Gaertner wrote 7 lines
> [...] > When clicking to jump to an event in the object inspector Lazarus > crashes. In this example I have clicked on BtnBills, but the console > out appears to show that I've clicked BtnCategories [...] This was the patch for the win32. The combobox text was lost. I hope it works now again.

That got it! Thanks,

Tony

Reply by email

andrew johnson
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…

oops.. I could have responded to this along time ago.. better check my mail more often! indeed does Sound like the problem with Booleans.. sort of. The problem with not being able to save boolean values was fixed by Mattias, and is one of the reason's we now use the 1.0.7 compiler. The other problem isn't exactly with Booleans,but may be contributing here. It is that Property Default values Don't act like expected(as compared to Delphi). This seems to present itself in various ways. one being that an integer or boolean property without a default is the same as a default of 0 or False. Which means that any property without a default but which is initialized to True or 0, will not be allowed to change in the lfm and therefore is always initialized to False.. never quite figured that out but that's the way of things.. The other aspect of it shows what I think is broken behavior in the FPC, that is a Default in an ancestor of a component acts bizarre, I never traced down the specifics, but essentially Visible is a TControl Property, which we set to default TRUE. But, it doesn't act like it is True in the descendants as it pertains to the LFM.. aka its almost as if you had set the default to FALSE like in Delphi. So long as it is never put into the lfm this is not an issue, because it simply uses the REAL default, that is, TRUE.

Anyway.. as you can see this may indeed be at least part of the problem. perhaps I should figure out the specifics and post it as a bug to FPC....

BTW, as far as I could tell we get the exact same behavior in Delphi mode, so I do not think it is another incompatibility there.

Andrew

Show quoted text 33 lines
On 15 Nov 2002, Tony Maro wrote: > On Fri, 2002-11-15 at 14:02, Tony Maro wrote: > > Wow, that's it... I've learned more about how Lazarus creates forms than > > I ever wanted to. ;-) > > > > When you add this unit to the form, for some reason the form sets > > visible := True explicitly declared in the .lfm (and .lrs of course) > > > > If I add the esdsound unit and EXPLICITLY set the visible property of > > the form to false in the designer, the problem does not occur. > > > > I REALLY feel like I'm carrying on a conversation with myself now... > sorry I didn't shove all this info into one mail, BUT, thought you'd > need like to know that every time I open the project the frmmain.visible > property is set back to visible. As long as I set that property to > false before I build, the application runs. If I don't the frmmain > variable is invalid when the app runs. > > Now, I KNOW that property probably should be true, but maybe this info > will help you guys get closer to the root of the problem... Wasn't there some problem with reading and writing of boolean properties in one of the earlier versions of Lazarus ? maybe this is still a consequence ? Michael. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
andrew johnson

Reply by email

Mattias Gaertner
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…
Show quoted text 15 lines
On Fri, 2002-11-15 at 15:34, Tony Maro wrote: > > I just created a new application, made two forms. Added no procedures, > uses, objects or anything. > > Both forms appear instantly when the application is run. Isn't it true > that only the main form (first in list) should be shown? > And it does this even without custom components compiled in. This is a recent bug addition... I haven't had this problem with multiple forms until now. All this time I thought it was my custom components but it appears it may have been a coincidence. But you're right Andrew, it appears to be a saving boolean property setting issue.

6 mails in 6 hours. Not rude, but somewhat talkactive, aren't you? ;) Ok, I will refer to your 7 mails plus the two answers:

The AV:
Application.CreateForm created forms with the statement: Ref:=NewForm.Create(Self);
This allocates the instance, calls the constructor and afterwards sets the reference (FrmMain). With Visible=True the constructor created the handle and fires some events, in which you used the FrmMain variable, which was not set at the moment.
This was incompatible to the VCL. I fixed that. The LCL now uses the VCL trick: First allocate the instance, then set the reference and then call the constructor.

Visible forms:
The form editor creates Forms with visible:=true.
I will check if this can be changed. As Andrew mentioned, there is a problem with default values for Boolean properties. Borlands compiler uses a special value to indicate the default. The fpc does not use such tricks.

Mattias

Reply by email

Tony Maro
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…

Sorry for the HTML, but I wanted to preserve line lengths for easier viewing...

This does NOT reproduce in a new blank application.� It's happening in CBTracker.

When clicking to jump to an event in the object inspector Lazarus crashes.� In this example I have clicked on BtnBills, but the console out appears to show that I've clicked BtnCategories (which at no time during this session have I touched.)� When I click to go to the BtnBills.OnClick event in the OI, it crashes.� I went back to a known good source from a week ago and it still does it, so I don't really think the .lfm is corrupted.� I even manually regenerated the .LRS just to make sure that wasn't part of the problem.� The application builds and runs fine.� It does this when you go to any event of any object including the form.

I also found that if I show a different form in the application and go to an event in it, then go back to the main form, everything works fine.� Save the project, reopen and try to go directly to an event of an object on the visible form and it crashes.

MouseUpOnControl BtnBills:TBUTTON

[TDesigner.MouseLeftUpOnControl] END

### TMethodPropertyEditor.GetValues

[TEventsCodeTool.GetCompatiblePublishedMethods] A UpperClassName=TFRMMAIN

[TEventsCodeTool.GetCompatiblePublishedMethods] B TRUE

[TEventsCodeTool.GetCompatiblePublishedMethods] C TRUE

[TEventsCodeTool.GetCompatiblePublishedMethods] D

[TEventsCodeTool.CreateExprListFromMethodTypeData] START

[TEventsCodeTool.CreateExprListFromMethodTypeData] A� i=0/1 Ident=TOBJECT

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitcatreport.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitbalancehist.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitsplit.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitsplash.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitfrmenterwithdrawal.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitenterdep.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/components/custom/unitgraph.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitworking.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitnewscheddep.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/chkschedule.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitstarting.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /home/tony/Projects/cbtracker/unitbalance.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/rtl/unix/linux.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/fcl/xml/xmlcfg.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/components/custom/checkbook.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/menus.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/components/custom/tmcal.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/stdctrls.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/buttons.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/extctrls.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/lresources.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/dialogs.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/graphics.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/controls.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/forms.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/rtl/unix/sysutils.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/fcl/linux/classes.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/rtl/objpas/objpas.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/rtl/linux/syslinux.pp

[TEventsCodeTool.CreateExprListFromMethodTypeData] B� i=0/1 Ident=TOBJECT CurExprType=Desc=Context SubDesc=None Node=Class File="/usr/src/fpc/rtl/linux/syslinux.pp"

[TEventsCodeTool.CreateExprListFromMethodTypeData] END

[TEventsCodeTool.GetCompatiblePublishedMethods] E Searching ...

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/clipbrd.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/actnlist.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/customtimer.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/lmessages.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/graphtype.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/interfacebase.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/lcllinux.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/lclproc.pas

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/lcltype.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/vclglobals.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/utrace.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/lazaruscvs/lazarus/lcl/imglist.pp

TPascalParserTool.BuildTree B OnlyIntf=TRUE� /usr/src/fpc/rtl/objpas/typinfo.pp

### TMethodPropertyEditor.SetValue A OldValue="BtnBillsCLICK" NewValue=BtnCategoriesCLICK

[TEventsCodeTool.PublishedMethodExists] A UpperClassName=TFRMMAIN

[TEventsCodeTool.PublishedMethodExists] B TRUE

[TEventsCodeTool.CreateExprListFromMethodTypeData] START

[TEventsCodeTool.CreateExprListFromMethodTypeData] A� i=0/1 Ident=TOBJECT

[TEventsCodeTool.CreateExprListFromMethodTypeData] B� i=0/1 Ident=TOBJECT CurExprType=Desc=Context SubDesc=None Node=Class File="/usr/src/fpc/rtl/linux/syslinux.pp"

[TEventsCodeTool.CreateExprListFromMethodTypeData] END

TPascalParserTool.BuildTree B OnlyIntf=FALSE� /home/tony/Projects/cbtracker/unitmain.pas

[TEventsCodeTool.CreatePublishedMethod] A AMethodName="BtnCategoriesCLICK" in "/home/tony/Projects/cbtracker/unitmain.pas"

[TEventsCodeTool.CreatePublishedMethod] invoke class completion

[TEventsCodeTool.CreatePublishedMethod] END

### TMethodPropertyEditor.SetValue END� NewValue=BtnCategoriesCLICK

#################### TOIPropertyGrid.ValueButtonClick

### TMethodPropertyEditor.Edit A OldValue=BtnCategoriesCLICK

An unhandled exception occurred at 0x081BFD6B :

Unable to show method. Plz fix errors in source.

� 0x081BFD6B� TMAINIDE__ONPROPHOOKSHOWMETHOD,� line 7172 of main.pp

[TMainIDE.Destroy] A

[TDesigner.Notification] opRemove Mainmenu1:TMAINMENU

An unhandled exception occurred at 0x08094FD9 :

Access violation

� 0x08094FD9� TCONTROLSELECTION__COUNT,� line 1284 of ./designer/controlselection.pp

� 0x08094FFC� TCONTROLSELECTION__INDEXOF,� line 1289 of ./designer/controlselection.pp

An unhandled exception occurred at 0x08257A1A :

Access violation

� 0x08257A1A

forms.pp - finalization section

Reply by email

Tony Maro
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…
Mattias Gaertner wrote
6 mails in 6 hours. Not rude, but somewhat talkactive, aren't you? ;) Ok, I will refer to your 7 mails plus the two answers:

Haha - What can I say but I work things out verbally.

I was just supplying new information about the problem as I came to it. Sorry for filling everyone's mailbox all day... Personally I have a fast connection and my mailserver is in my kid's closet so I don't have to worry about downloading them myself. ;-)

This was incompatible to the VCL. I fixed that. The LCL now uses the VCL trick: First allocate the instance, then set the reference and then call the constructor.

Yes, that seems to have stopped the crashes I think...

Visible forms: The form editor creates Forms with visible:=true.

Right, but what about the fact that this has changed in the last few days or weeks... because now creating a brand new application with two forms causes both forms to immediately show at startup (just tested after updating from CVS) yet rebuilding an application created a few weeks ago doesn't do that if the .lrs file hasn't been changed. Something is still a little wacko and it wasn't doing that 2 weeks ago. I'm not positive if it changed sooner or later because I didn't update my CVS for a couple of weeks until the new component install code was released.

-Tony

Reply by email

Tony Maro
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…
Tony Maro wrote 7 lines
I just created a new application, made two forms. Added no procedures, uses, objects or anything. Both forms appear instantly when the application is run. Isn't it true that only the main form (first in list) should be shown?

And it does this even without custom components compiled in.

This is a recent bug addition... I haven't had this problem with multiple forms until now. All this time I thought it was my custom components but it appears it may have been a coincidence. But you're right Andrew, it appears to be a saving boolean property setting issue.

-Tony

Reply by email

Tony Maro
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Mattias Gaertner wrote 6 lines
> > Does this mean you fixed it in CVS? Yes. Does it solve your problem?

Well, no. It works properly on a brand new project, but attempting to add it to CheckBook Tracker results in the FrmMain variable going wacko. I get access violations when I try to access any properties of the form such as clientheight or title.

Don't ask me why, but it's probably something to do with the size of my application...

Source to test the component in (still):

http://members.telocity.com/~tonymaro/cbbad.tgz

As is, the above download WILL WORK. But if you drop the TESDSound component on the form (or just add esdsound to the uses clause), it does something with the main form's variable that makes it invalid when the program runs. I tested and it's NOT related to the splash screen trick I'm doing.

The only thing that comes to mind might be either the size of the application, the number of controls on the main form, or the number of units in the USES clause of the main form that is affecting things.

-Tony

Reply by email

Tony Maro

In my ongoing effort to figure out why my custom controls aren't working right from the IDE, I've run into something new.

If I compile into Lazarus JUST the TESDSound component I've made, create a new project, drop it on the form...

Then drop a button on the form and try to add an onclick event to the button Lazarus crashes. (console output is attached)

Something odd is definately going on with custom components compiled in
- it MIGHT be my component code, so I'm not pointing fingers ;-)

The component by itself is available (if you haven't already downloaded the cbbad.tgz from my previous mail) at:

http://members.telocity.com/~tonymaro/esdsound.tgz

The only place that I would think my code could affect things is in the .create method which is simply:

constructor TESDSound.Create(AOwner: TComponent);
begin
     Reallocmem(SoundFiles, 0);
     NumSoundFiles := 0;
     inherited Create(AOwner);
     if csDesigning in ComponentState then exit;
     // design time affect should stop here...
     if enabled then begin
        SetEnabled(True);
     end;
end;

Thanks,

Tony

NOTE: editor options config file not found
Note: codetools config file not found - using defaults TPascalParserTool.BuildTree B OnlyIntf=TRUE /home/tonym/Projects/test/unit1.pas TMainIDE.DoOpenEditorFile END "/home/tonym/Projects/test/unit1.pas" ************************************************************ MouseDownOnControl Form1:TForm1 No Shift down, No CTRL down [TDesigner.MouseDownOnControl] END
************************************************************ MouseUpOnControl Form1:TForm1
[TCustomFormEditor.CreateComponent] Class='TESDSOUND' opInsert
TPascalParserTool.BuildTree B OnlyIntf=TRUE /home/tonym/Projects/test/unit1.pas TPascalParserTool.BuildTree B OnlyIntf=FALSE /home/tonym/Projects/test/unit1.pas NEW COMPONENT ADDED: Form.ComponentCount=1 NewCI.Control.Owner.Name=Form1 [TDesigner.MouseLeftUpOnControl] END
************************************************************ MouseDownOnControl Form1:TForm1 No Shift down, No CTRL down [TDesigner.MouseDownOnControl] END
************************************************************ MouseUpOnControl Form1:TForm1
[TCustomFormEditor.CreateComponent] Class='TBUTTON' opInsert
Parent is 'Form1'
TPascalParserTool.BuildTree B OnlyIntf=TRUE /home/tonym/Projects/test/unit1.pas TPascalParserTool.BuildTree B OnlyIntf=TRUE /home/tonym/Projects/test/unit1.pas TPascalParserTool.BuildTree B OnlyIntf=FALSE /home/tonym/Projects/test/unit1.pas NEW COMPONENT ADDED: Form.ComponentCount=2 NewCI.Control.Owner.Name=Form1 [TDesigner.MouseLeftUpOnControl] END
### TMethodPropertyEditor.GetValues
[TEventsCodeTool.GetCompatiblePublishedMethods] A UpperClassName=TFORM1 TPascalParserTool.BuildTree B OnlyIntf=TRUE /home/tonym/Projects/test/unit1.pas [TEventsCodeTool.GetCompatiblePublishedMethods] B TRUE [TEventsCodeTool.GetCompatiblePublishedMethods] C TRUE [TEventsCodeTool.GetCompatiblePublishedMethods] D
[TEventsCodeTool.CreateExprListFromMethodTypeData] START [TEventsCodeTool.CreateExprListFromMethodTypeData] A i=0/1 Ident=TOBJECT TPascalParserTool.BuildTree B OnlyIntf=TRUE /home/tonym/lazarus/lcl/buttons.pp [TEventsCodeTool.CreateExprListFromMethodTypeData] B i=0/1 Ident=TOBJECT CurExprType=Desc=None SubDesc=None [TEventsCodeTool.CreateExprListFromMethodTypeData] END [TEventsCodeTool.GetCompatiblePublishedMethods] E Searching ... #################### TOIPropertyGrid.ValueButtonClick ### TMethodPropertyEditor.Edit A OldValue=
### TMethodPropertyEditor.Edit B FormMethodName=Button1CLICK ### TMethodPropertyEditor.SetValue A OldValue="" NewValue=Button1CLICK [TEventsCodeTool.PublishedMethodExists] A UpperClassName=TFORM1 [TEventsCodeTool.PublishedMethodExists] B TRUE
TPascalParserTool.BuildTree B OnlyIntf=FALSE /home/tonym/Projects/test/unit1.pas [TEventsCodeTool.CreatePublishedMethod] A AMethodName="Button1CLICK" in "/home/tonym/Projects/test/unit1.pas" ### TCodeToolManager.HandleException: "EACCESSVIOLATION: Access violation" at Line=8 Col=70 in "/home/tonym/Projects/test/unit1.pas" An unhandled exception occurred at 0x081AF14E :
Unable to create new method. Plz fix errors in source. 0x081AF14E TMAINIDE__ONPROPHOOKCREATEMETHOD, line 7144 of main.pp

[TMainIDE.Destroy] A
An unhandled exception occurred at 0x0818665F :
Access violation
0x0818665F TAVLTREENODEMEMMANAGER__DISPOSENODE, line 998 of avl_tree.pas 0x4C373A3B main, line 302 of lcllinux.pp
0x0000D7B2

forms.pp - finalization section
An unhandled exception occurred at 0x0818665F :
Access violation
0x0818665F TAVLTREENODEMEMMANAGER__DISPOSENODE, line 998 of avl_tree.pas 0x0824C48C
0x0000D7B2

Reply by email

andrew johnson
to Tony Maro

well.. first things first.. realocmem can have unpredictable results on an uninitialized block.. since this is uninitialized it might be contributing to the problem. You should instead init it with SoundFiles := nil;

Andrew

Tony Maro wrote 37 lines
In my ongoing effort to figure out why my custom controls aren't working right from the IDE, I've run into something new. If I compile into Lazarus JUST the TESDSound component I've made, create a new project, drop it on the form... Then drop a button on the form and try to add an onclick event to the button Lazarus crashes. (console output is attached) Something odd is definately going on with custom components compiled in - it MIGHT be my component code, so I'm not pointing fingers ;-) The component by itself is available (if you haven't already downloaded the cbbad.tgz from my previous mail) at: http://members.telocity.com/~tonymaro/esdsound.tgz The only place that I would think my code could affect things is in the .create method which is simply: constructor TESDSound.Create(AOwner: TComponent); begin Reallocmem(SoundFiles, 0); NumSoundFiles := 0; inherited Create(AOwner); if csDesigning in ComponentState then exit; // design time affect should stop here... if enabled then begin SetEnabled(True); end; end; Thanks, Tony

Reply by email

Tony Maro
to Unknown author: Wasn't there some problem with reading and writing of boolean properties in one of the…
Wasn't there some problem with reading and writing of boolean properties in one of the earlier versions of Lazarus ? maybe this is still a consequence ?

Well, here's the thing though. A form normally has it's visible property set in design mode. This does not cause "VISIBLE = True" to appear in the .LFM though. For some reason, my form has gotten so large and the addition of the unit to the uses clause, causes it to decide to put VISIBLE = True in the .LFM. If I had to guess I would say this is causing the form to be created at runtime a SECOND time, or somehow causing the variable pointing to the form object to be otherwise corrupted.

Okay, news flash here...

I just created a new application, made two forms. Added no procedures, uses, objects or anything.

Both forms appear instantly when the application is run. Isn't it true that only the main form (first in list) should be shown?

-Tony

Reply by email

Mattias Gaertner
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
well.. first things first.. realocmem can have unpredictable results on an uninitialized block.. since this is uninitialized it might be contributing to the problem. You should instead init it with SoundFiles := nil;

TObject properties are auto initialized before the constructor is called.

I replayed Tony's description and found a bug in the find declaration. This bug might also be the one, that Danie described (OI events).

Mattias

Show quoted text 46 lines
Andrew On Thu, 2002-11-14 at 11:07, Tony Maro wrote: > In my ongoing effort to figure out why my custom controls aren't working > right from the IDE, I've run into something new. > > If I compile into Lazarus JUST the TESDSound component I've made, create > a new project, drop it on the form... > > Then drop a button on the form and try to add an onclick event to the > button Lazarus crashes. (console output is attached) > > Something odd is definately going on with custom components compiled in > - it MIGHT be my component code, so I'm not pointing fingers ;-) > > The component by itself is available (if you haven't already downloaded > the cbbad.tgz from my previous mail) at: > > http://members.telocity.com/~tonymaro/esdsound.tgz > > The only place that I would think my code could affect things is in the > .create method which is simply: > > constructor TESDSound.Create(AOwner: TComponent); > begin > Reallocmem(SoundFiles, 0); > NumSoundFiles := 0; > inherited Create(AOwner); > if csDesigning in ComponentState then exit; > // design time affect should stop here... > > if enabled then begin > SetEnabled(True); > end; > end; > > > Thanks, > > Tony _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Tony Maro
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Tony Maro wrote 5 lines
I know, I'm carrying on a conversation with myself, but the corruption problem is definitely in the form's resource. I am able to replace the unitmain.lrs file with a known good one and recompile and the application works.

Wow, that's it... I've learned more about how Lazarus creates forms than I ever wanted to. ;-)

When you add this unit to the form, for some reason the form sets
visible := True explicitly declared in the .lfm (and .lrs of course)

If I add the esdsound unit and EXPLICITLY set the visible property of the form to false in the designer, the problem does not occur.

-Tony

Reply by email

Unknown author
to Tony Maro: I REALLY feel like I'm carrying on a conversation with myself now... sorry I didn't shove…
Tony Maro wrote 20 lines
On Fri, 2002-11-15 at 14:02, Tony Maro wrote: > Wow, that's it... I've learned more about how Lazarus creates forms than > I ever wanted to. ;-) > > When you add this unit to the form, for some reason the form sets > visible := True explicitly declared in the .lfm (and .lrs of course) > > If I add the esdsound unit and EXPLICITLY set the visible property of > the form to false in the designer, the problem does not occur. > I REALLY feel like I'm carrying on a conversation with myself now... sorry I didn't shove all this info into one mail, BUT, thought you'd need like to know that every time I open the project the frmmain.visible property is set back to visible. As long as I set that property to false before I build, the application runs. If I don't the frmmain variable is invalid when the app runs. Now, I KNOW that property probably should be true, but maybe this info will help you guys get closer to the root of the problem...

Wasn't there some problem with reading and writing of boolean properties in one of the earlier versions of Lazarus ? maybe this is still a consequence ?

Michael.

Reply by email

Tony Maro
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Mattias Gaertner wrote 12 lines
On 14 Nov 2002 11:25:55 -0500 andrew johnson wrote: > well.. first things first.. realocmem can have unpredictable results on > an uninitialized block.. since this is uninitialized it might be > contributing to the problem. You should instead init it with SoundFiles > := nil; TObject properties are auto initialized before the constructor is called. I replayed Tony's description and found a bug in the find declaration. This bug might also be the one, that Danie described (OI events).

I thought since that was simply a pointer anyway that I shouldn't need to worry about it. But, I tried Andrew's suggestion anyway and it didn't make a difference.

Does this mean you fixed it in CVS?

Thanks,
Tony

Reply by email

Tony Maro
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Tony Maro wrote 29 lines
On Thu, 2002-11-14 at 11:51, Mattias Gaertner wrote: > > > > Does this mean you fixed it in CVS? > > Yes. > Does it solve your problem? > Well, no. It works properly on a brand new project, but attempting to add it to CheckBook Tracker results in the FrmMain variable going wacko. I get access violations when I try to access any properties of the form such as clientheight or title. Don't ask me why, but it's probably something to do with the size of my application... Source to test the component in (still): http://members.telocity.com/~tonymaro/cbbad.tgz As is, the above download WILL WORK. But if you drop the TESDSound component on the form (or just add esdsound to the uses clause), it does something with the main form's variable that makes it invalid when the program runs. I tested and it's NOT related to the splash screen trick I'm doing. The only thing that comes to mind might be either the size of the application, the number of controls on the main form, or the number of units in the USES clause of the main form that is affecting things.

By the way, once it's done this it corrupts the application. Just removing the uses reference won't let the application work anymore.

Is it corrupting the frmmain lfm or resource somehow?

I compared a before and after and the frmmain.lfm adds a VISIBLE = TRUE
line to the form object - that's the only difference I noticed. The form with the VISIBLE = TRUE set doesn't work when you launch the app.

Not saying that's the problem, mind you...

-Tony

Reply by email

Tony Maro
to Tony Maro: In my ongoing effort to figure out why my custom controls aren't working right from the…
Tony Maro wrote 8 lines
Is it corrupting the frmmain lfm or resource somehow? I compared a before and after and the frmmain.lfm adds a VISIBLE = TRUE line to the form object - that's the only difference I noticed. The form with the VISIBLE = TRUE set doesn't work when you launch the app. Not saying that's the problem, mind you...

I know, I'm carrying on a conversation with myself, but the corruption problem is definitely in the form's resource. I am able to replace the unitmain.lrs file with a known good one and recompile and the application works.

-Tony

Reply by email