Jump to content


Photo

Severe Anchor Problems with NxPageControl


  • Please log in to reply
13 replies to this topic

#1 wvd_vegt

wvd_vegt

    Master Member

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

Posted 04 December 2007 - 01:32 PM

Hi Boki,

I've got a severe problem with anchored controls on a NxPageControl!

When I create some pages and put some NxControls on it and anchor them to all sides (with Anchors property) I see that only the activepage is resized properly when I resize the application in the TForm.OnCreate handler. The other controls on non visible pages are not resized properly.

The NxPageControl is alClient aligned to the Form and has a Margin of 4.
G.W. van der Vegt

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 December 2007 - 03:53 PM

Hello Wim,

Maybe it is not possible different, because I am hidding innactive pages and this maybe block anchors sad.gif

I will see what I can do here. If you have any suggestion , please tell me.

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 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 December 2007 - 04:01 PM

Hello Wim,

I suggest disabling next line in NxCustomNotebook.SetActivePage:

CODE
  { old page }
  if Assigned(FActivePage) then
  begin
//    FActivePage.Hide; { page is not hidden in design-time } <------ comment this line
    FActivePage.DoHide; { event }
    AOldIndex := FActivePage.PageIndex;
  end else AOldIndex := -1;


But, I am not sure is this will cause some other problems, like tab going into hidden page and similar.

I will test it more, if you can please tell me if you spot some anomaly.

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.

#4 wvd_vegt

wvd_vegt

    Master Member

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

Posted 04 December 2007 - 04:34 PM

Thanks for looking into it.

Strangely enough is resizing at designtime ok. It only happens at runtime (even if i do not set the bounds of the app at startup, controls just don't anchor on certain sides as if the anchor property isn't loaded correctly).
G.W. van der Vegt

#5 wvd_vegt

wvd_vegt

    Master Member

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

Posted 04 December 2007 - 05:49 PM

Hi Boki,

I now can get 3 of the 6 tabs to align properly. The rest of the tabs and their controls refuse to anchor(or only do so horizontally). It's the first two and the active Tabsheet one at designtime (or the last one i edited, not sure about that).

QUOTE (wvd_vegt @ Dec 4 2007, 04:34 PM) <{POST_SNAPBACK}>
Thanks for looking into it.

Strangely enough is resizing at designtime ok. It only happens at runtime (even if i do not set the bounds of the app at startup, controls just don't anchor on certain sides as if the anchor property isn't loaded correctly).

G.W. van der Vegt

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 December 2007 - 07:06 PM

Hello Wim,

In run-time, page can't be hidden and this is why all work fine. But in run-time, if I don't hide page (TNxTabSheet), user will be able to Tab troughs 2 pages even one is inactive.

Maybe I can try to call resize of all inactive pages in WM_SIZE message.

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 wvd_vegt

wvd_vegt

    Master Member

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

Posted 04 December 2007 - 07:10 PM

Hi Boki,

I hope you find a good solution. For now (due to pressure on the project) I hardcoded the resizing.

QUOTE (Boki (Berg) @ Dec 4 2007, 07:06 PM) <{POST_SNAPBACK}>
Hello Wim,

In run-time, page can't be hidden and this is why all work fine. But in run-time, if I don't hide page (TNxTabSheet), user will be able to Tab troughs 2 pages even one is inactive.

Maybe I can try to call resize of all inactive pages in WM_SIZE message.

Best regards

G.W. van der Vegt

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 December 2007 - 07:33 PM

Hello Wim,

Can you please tell me how do you do this? Do you have force anchors?

I have try to not hide page (commenting line in sample which I post in previous posts), but Tabs are moving trough visible and invisible pages then sad.gif

I will need to somehow disable inactive pages instead hiding 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.

#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 December 2007 - 07:40 PM

Update: It seems that each page must be opened at least once that all works.

Maybe there is a hope for this problem smile.gif
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.

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 December 2007 - 10:17 PM

Hello Wim,

Change next procedure in NxPageControl.pas file:

CODE
procedure TNxTabSheet.SetParentComponent(Value: TComponent);
begin
  inherited;
  if Value is TNxCustomNotebook then
  begin
    FPageControl := TNxCustomNotebook(Value);
    if Self <> FPageControl.ActivePage then Hide;
    FPageControl.FPageList.Add(Self);
    SetBounds(0, 0, FPageControl.ClientWidth, FPageControl.ClientHeight); // <------ new line
  end;
end;


Please tell me how it works now.

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 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 05 December 2007 - 12:38 AM

i didnt read all yet, but mayb this will help too?

http://www.bergsoft....?showtopic=1781

#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 05 December 2007 - 01:21 AM

Hello Emailaya,

Maybe this is same problem which you have reported.

Try to apply this fix and test it for your problem.

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 wvd_vegt

wvd_vegt

    Master Member

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

Posted 05 December 2007 - 03:50 PM

Hi Boki,

Hurray it seems to work properly (i removed the first fix and applied the 2nd one). Keep testing it a bit more please.

What a single line of code can make a difference!

QUOTE (Boki (Berg) @ Dec 5 2007, 01:21 AM) <{POST_SNAPBACK}>
Hello Emailaya,

Maybe this is same problem which you have reported.

Try to apply this fix and test it for your problem.

Best regards

G.W. van der Vegt

#14 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 05 December 2007 - 03:52 PM

Great Wim smile.gif

I will continue testing it too. Solution is possible, only to see if this is righ one.

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users