Jump to content


Photo

AV in NxPageControl in a TFrame


  • Please log in to reply
19 replies to this topic

#1 knightware

knightware
  • Members
  • 11 posts

Posted 04 October 2007 - 02:46 PM

I am getting an Access Violation with the NxPageControl when it is placed in a TFrame descendant. I am using C++ Builder 2007 Professional.
  • If I place a frame in a form and drop a NxPageControl on the frame, I can run the program and close it without a problem.
  • If I add a NxTabSheet to the NxPageControl and run it then close the program, I get an AV somewhere in the TNxCustomNotebook destructor.
  • If I place the NxPageControl and NxTabSheet directly on a form, there is no problem.
I am using frames extensively in my product and I like the appearance of the NxPageControl very much. I hope there is a solution sad.gif

- Phyllis

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 04 October 2007 - 03:24 PM

Hello Phyllis,

Can you please give me more details about 2nd step:

Does this happen when you add page in Frame on form?

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 knightware

knightware
  • Members
  • 11 posts

Posted 04 October 2007 - 03:47 PM

Yes, exactly. Adding a tabsheet to the pagecontrol on a frame in a form is the problem scenario.

I created a test project containing a form and a frame. I dropped the pagecontrol on the frame and added the frame to the main form. Running this works. Add a tabsheet to the page control in the frame and recompile -> AV at program close.

- Phyllis

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 04 October 2007 - 06:48 PM

Hello Phyllis,

Unfortunatelly this is known bug sad.gif Currently, only solution is to add tab in run-time. I have leave this bug beside until I figure how to solve it. I will work on it again next weekend and hopefully solve it now for good.

I am sorry again.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 knightware

knightware
  • Members
  • 11 posts

Posted 04 October 2007 - 07:23 PM

That will be fine. I'm delighted to know that you are aware of it and willing to address it. I wish you luck in pursuing this one!

- Phyllis

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 07 October 2007 - 11:57 PM

Hello Phyllis,

I will need few more days to finish this bug. I am sorry again for waiting, it causes me a lot of problems sad.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 knightware

knightware
  • Members
  • 11 posts

Posted 08 October 2007 - 02:05 PM

Ok.

This one is critical for me, so I don't mind waiting a bit for the fix. I'm sorry it's troublesome!

- Phyllis

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 08 October 2007 - 11:18 PM

Hello Phyllis,

Thank you.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 knightware

knightware
  • Members
  • 11 posts

Posted 12 October 2007 - 01:53 PM

Hi Boki,

Any progress on my problem?

Have a nice day,
- Phyllis

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 12 October 2007 - 03:06 PM

Hello Phyllis,

I am sorry to tell but not, I have made a pausa in one day for releasing new versions and today I will work on it again.

I am sorry again for waiting.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#11 knightware

knightware
  • Members
  • 11 posts

Posted 20 October 2007 - 02:11 PM

Boki,

Any news? My guitar gently weeps as I await your cure to my problem...

- Phyllis, feeling a bit punchy this morning!

#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 October 2007 - 02:34 PM

Hello Phyllis,

I am sorry not. I am back to this problem every day.

If you can't wait anymore, I will refund your order and you may still use components (if you find any other usage instad placing component on frame).

I will continue working on it, but it is definitelly one of hardest problem I have encounter while I am working on components. I am having similar problem with NextGrid too.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#13 knightware

knightware
  • Members
  • 11 posts

Posted 20 October 2007 - 09:24 PM

Boki,

It sounds like you are having quite a challenge. I can wait longer, but I am counting on using both NxPageControl and especially NextDBGrid in my product.

I'll stay tuned...
- Phyllis

#14 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 20 October 2007 - 09:58 PM

Hello Phyllis,

In last several days I have made to fix NxPageControl, but new page need to be added in dfm file directly:

Right-click on Form -> View As Text and then add new page with next dfm code:

CODE
      object MyNewTab: TNxTabSheet
        Caption = 'abcd'
      end


Right-click again and chose View As Form. New page will appear inside NxPageControl as it is added from design-time in standard way.

Full example:

CODE
object Form1: TForm1
  Left = 312
  Top = 216
  Width = 1142
  Height = 656
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  inline Frame21: TFrame2
    Left = 188
    Top = 52
    Width = 745
    Height = 462
    TabOrder = 0
    inherited NxPageControl1: TNxPageControl
      Left = 16
      Top = 8
      Width = 569
      Height = 373
      ActivePage = Frame21.NxTabSheet1
      ActivePageIndex = 0
      inherited NxTabSheet1: TNxTabSheet
        Width = 569
        Height = 352
      end
      inherited NxTabSheet2: TNxTabSheet
        Width = 569
        Height = 352
        Caption = 'test'
        Color = clFuchsia
      end
      inherited NxTabSheet3: TNxTabSheet
        Width = 569
        Height = 352
        TabWidth = 200
      end
      object NxTabSheet10: TNxTabSheet // <----------------- manually added
        Left = 0
        Top = 21
        Width = 569
        Height = 352
        Caption = 'test page'
        Color = clRed
        DisplayMode = tdGlyph
        ImageIndex = 0
        Margin = 0
        PageIndex = 3
        PageVisible = True
        TabColor = clWindow
        TabFont.Charset = DEFAULT_CHARSET
        TabFont.Color = clWindowText
        TabFont.Height = -11
        TabFont.Name = 'MS Sans Serif'
        TabFont.Style = []
        TabWidth = 0
        TransparentColor = clNone
      end
      object NxTabSheet22: TNxTabSheet // <----------------- manually added
        Left = 0
        Top = 21
        Width = 569
        Height = 352
        Caption = 'abcd'
        DisplayMode = tdGlyph
        ImageIndex = 0
        Margin = 0
        PageIndex = 4
        PageVisible = True
        TabColor = clWindow
        TabFont.Charset = DEFAULT_CHARSET
        TabFont.Color = clWindowText
        TabFont.Height = -11
        TabFont.Name = 'MS Sans Serif'
        TabFont.Style = []
        TabWidth = 0
        TransparentColor = clNone
      end
    end
  end
end


All this work fine (there are both inherited and new pages), but I am still working on how to made it work in design-time with standard way (right-click -> Add New Page).

If you want, I may send you my release with this partial fix. I am continuing to work on it.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#15 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 21 October 2007 - 09:43 PM

Hello,

With great Deon's help, new page now may be added in design-time (frame in form) but AV jump when starting.

Next things work fine:

- Add pages inside frame directly
- Modify pages inside frame on form. Example: second page may change color, caption...

Problem most probably somewhere in dfm writing. I have see that new page (added on frame in form) is not added into Pages array and this cause AV.

I will need to look more, and maybe look for help inside CodeGear's (Borland) newsgroups.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#16 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 22 October 2007 - 08:30 AM

Hi Boki

I think that maybe the way it works now is the correct way. If you want to change something in the pagecontrol, you must change it in the ancestor (in the frame) and all forms that use the frame will be updated. If you try to add a page directly to the pagecontrol inside the descendant (the frame on the form), you are actually trying to change the ancestor (the frame) which should not be allowed anyway.

If you look at the way that Delphi handles other controls in frames, you will see what I mean.

Make a new frame with a TPageControl (standard Delphi pagecontrol) and one TButton on it.
Add two new pages to the pagecontrol.
Add the frame to a form.
Now try to add a new page directly to the pagecontrol in the frame on the form.

Delphi won't allow you to do this (maybe because of the same problem we are having now?)

Now try to delete the button on the frame in the form. Again, Delphi won't allow you to do this.

If you select the frame on the form, and then drop another TButton onto the frame (in the form) you will see that the new button's parent is the form - not the frame.

I'm no expert when it comes to frames (I don't really use them much), but it looks to me like this is standard behaviour - that you cannot make changes to the original frame in the descendant (on the form where the frame is used).

Maybe you should just disable adding an deleting pages directly in the frame on the form, like it is with Delphi's standard TPageControl?

Regards,
Deon

#17 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 22 October 2007 - 01:41 PM

Hi

I've had similair problems with frames and traced it back to shorcut code inside the rtl (forms.pas). Inside the Frame's destructor i had to add code to free notifications to all ActionLists involved. That solved the av's. in my case. So code like:

CODE
destructor TMyFrame.Destroy;
begin
  //Fixes an AV in Forms.pas
  _TaakEditor.FreeNotification(ActionList1);
  _MainForm.FreeNotification(ActionList1);

  inherited;
end;


Where TaakEditor and _Mainform are two forms containing an TActionList.

Maybe this helps...

ps To be more generic you could use TypInfo and walk all components searching for TActionLists.
G.W. van der Vegt

#18 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 22 October 2007 - 04:17 PM

Hello Deon,

I have spot it too, but I am receiving this requests from time to time and it seems that users think that this is common usage.

Also, maybe other 3rd party wendors have solve this problem.

@Wim, I will look at it too. Thanks!

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#19 knightware

knightware
  • Members
  • 11 posts

Posted 25 October 2007 - 05:53 PM

The last few posts have been a lot to digest.

First a few clarifications - I'm not placing a NxPageControl on a frame, adding the frame to a form and overriding the pagecontrol contents on the form. Instead, I am placing the NxPageControl on a frame and adding tabsheets there, and dropping the frame on a form.

Second, I am using C++ Builder 2007. It is having problems with frame inheritance that I have posted to QC. I have no confidence that it will be resolved (yuck.) Just as a sanity check, I looked at the help file and found this:

"A frame, like a form, is a container for other components. It uses the same ownership mechanism as forms for automatic instantiation and destruction of the components on it, and the same parent-child relationships for synchronization of component properties. But frames can be nested within forms or other frames, and they can be saved on the Component palette for easy reuse. After a frame is created and saved, it continues to function as a unit and to inherit changes from the components (including other frames) it contains. Moreover, an embedded frame continues to inherit changes made to the frame from which it is derived. "


I think that says that frame inheritance should work. It did in C++ Builder 6.

So, I suspect that the problem I have is a combination of BCB2007 bugs and a problem writing the dfm file in which a NxPageControl resides. I truly appreciate your working on this.

An aside -
Instead of TFrames, what do you use when you have a collection of controls that appear on more than one form? Based on the help quoted above, TFrame fits my requirement (except is doesn't work any more.)

Thanks,
- Phyllis

#20 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 25 October 2007 - 09:18 PM

Hello Phyllis,

Maybe all is workin for you now smile.gif If you want, I may send you new version to test it again.

You may add/delete pages from Frame , even change pages inside Form. Adding page inside Frame on Form causes a problems sad.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users