Sign in Join

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

Mailing lists / lazarus / 2000-02

Problem adding a tab when TNotebook is visible

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Shane Miller

I have looked at this problem and need help.
If I run lazarus and press PROJECT - NEW the dialog appears with unit1 in it. If I go and press FILE - NEW UNIT then it crashes. I've traced it but lost it somewhere in gtk. It makes it all the way out of my code and crashes trying to do some event in gtk.

I initially thought it was the mwedit component but I commented that out and it still crashed. If you run Lazarus and instead of pressing PROJECT NEW you press FILE - NEW a few times, then the tabs are added because the dialog has not yet been displayed. If you then select PROJECT - NEW you'll see the units in the dialog. If you press FILE _ NEW UNIT it'll crash now that the tnotebook is being displayed.

Any help?
Shane

Reply by email

Marc Weustink
to Shane Miller
Show quoted text 5 lines
Ok I tracked down the problem. It has to do with the way pages are added. After a page has been added (in delphi) it receives focus. We do the same, only the page isn't added yet ;-). As a temp solution I removed (and committed) this, and I'm looking for a way to handle the focus.

This looked like the problem, but the real problem is larger, some parts of the notebook need to be recoded.
In GTK to get a user caption on a page, you need a label. This label is created by way of a TLabel. The GTK part of this label is later on used as the page label.
This aproach has two nasty side effects:
1) It is platform dependent. In a non GTK environment you'll end up with an extra label
2) Since it was a LCL control it has still all events and such attached to it. This resulted in our crash when the control is visible (events are attached when a control is visible, since on a invisible notebook control the label was used before it went visible, the events were never attached)

Point 2 you might overcome by first detaching the signals, point 1 still remains. When I find some time tomorrow I'll fix it.

Marc

Reply by email

Marc Weustink
to Shane Miller: I have looked at this problem and need help. If I run lazarus and press PROJECT - NEW the…
Shane wrote
Thanks for did you use to figure this out? I use DDD but haven't really figured out how to use it that well yet so I couldn't tell what event was being fired...

First I started with a little test project, containing only a form, a button and a notebook.
With DDD I found out that it dumped somewhere deep in gtk so that wasn't much help.
Then I looked at the last message lazarus had written. It was something like: pageindex now set to 1
Ok, now we have the last know executed line, so you can set a breakpoint there. And indeed after setting the page index it crashed. Another thing you could read was a number of IntSendmessage3 lines (TPAGE --> Sent LM_Message: $xxxx). The last message was something like $4DB (addnbpage ?? I can't remember)

All this brought me to AddNBPage and there I remembered some questions I had when I first saw this code, also remembering that there still was some work to do but had little importance to me.
Given all this I started wondering what the difference was between a visible and a non visible notebook and why it worked in the first place when I fixed the notebook months ago. The only difference is the way GTK components are created and when.

Marc

Reply by email

Shane Miller
to Shane Miller: I have looked at this problem and need help. If I run lazarus and press PROJECT - NEW the…

Thanks for did you use to figure this out? I use DDD but haven't really figured out how to use it that well yet so I couldn't tell what event was being fired...
---------------------------------------
Shane Miller
Take a look at other product/projects of mine below!

Get paid to surf the net!
http://alladvantage.com/go.asp?refid=DEX-870

Get paid to surf the net by clicking here too!!!
http://epipo.com/sine.asp?dex870

Home page : http://www.lakefield.net/~smiller

Auto-IP Publisher : http://www.lakefield.net/~smiller/autoip

Advanced Clipboard : http://www.lakefield.net/~smiller/advclipboard

Lazarus : http://www.miraclec.com/lazarus

Earlier message 42 lines
----- Original Message ----- From: "Marc Weustink" To: Sent: Friday, February 25, 2000 6:51 PM Subject: Re: [lazarus] Problem adding a tab when TNotebook is visible > At 01:01 26-02-2000 +0100, I wrote: > > >Ok I tracked down the problem. It has to do with the way pages are added. > >After a page has been added (in delphi) it receives focus. We do the same, > >only the page isn't added yet ;-). > >As a temp solution I removed (and committed) this, and I'm looking for a > >way to handle the focus. > > This looked like the problem, but the real problem is larger, some parts of > the notebook need to be recoded. > In GTK to get a user caption on a page, you need a label. This label is > created by way of a TLabel. The GTK part of this label is later on used as > the page label. > This aproach has two nasty side effects: > 1) It is platform dependent. In a non GTK environment you'll end up with an > extra label > 2) Since it was a LCL control it has still all events and such attached to > it. This resulted in our crash when the control is visible (events are > attached when a control is visible, since on a invisible notebook control > the label was used before it went visible, the events were never attached) > > Point 2 you might overcome by first detaching the signals, point 1 still > remains. When I find some time tomorrow I'll fix it. > > Marc > > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

Marc Weustink
to Shane Miller: I have looked at this problem and need help. If I run lazarus and press PROJECT - NEW the…
Shane wrote 7 lines
I have looked at this problem and need help. If I run lazarus and press PROJECT - NEW the dialog appears with unit1 in it. If I go and press FILE - NEW UNIT then it crashes. I've traced it but lost it somewhere in gtk. It makes it all the way out of my code and crashes trying to do some event in gtk. Any help?

Ok I racked down the problem. It has to do with the way pages are added. After a page has been added (in delphi) it receives focus. We do the same, only the page isn't added yet ;-).
As a temp solution I removed (and committed) this, and I'm looking for a way to handle the focus.

Marc

Reply by email