Jump to content


Photo

creating nxTabSheet causes OnChange event


  • Please log in to reply
14 replies to this topic

#1 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 06 November 2006 - 10:02 PM

hi
when creating new nxTabSheet
the event nxPageControlChange is triggered

i dont think this should happen

#2 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 06 November 2006 - 10:14 PM

in SetActivePage event
i added in the last line:
if (not(csDestroying in ComponentState)) and (not(csLoading in ComponentState)) then DoChange; { event }
and now its ok

ok i mean the event is not triggered
but i think u should look if does not conflicts with other things

i also noticed u have this as the first line in your SetActivePage event:
if csDestroying in ComponentState then Exit;
and the last line was
if not(csDestroying in ComponentState) then DoChange; { event }

1 of the above should be ommited, no?

#3 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 06 November 2006 - 10:39 PM

what is the insert parameter in AddPage method?

what exactly adaptivecolor , means?

if a tab does not fit into the current view, whole of it disappears until the user clicks the scroller
is it possible to show part of that tab, and clicking on the scroller makes all tabs go left/right by x pixels?

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 07 November 2006 - 03:37 PM

Hello Emailaya,

I think that OnChange should occur when you add a Page. I don't think that this is not normal.

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 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 07 November 2006 - 03:50 PM

regular pagecontrol does not trigger this event
OnChange should occur only when a new page is selected
new page added, does not mean it gets focus (actually it doesnt)

it causes problem that my OnChange code is executed
just when my application starts so it throws exception bcoz some of the objects were not defined yet

#6 wvd_vegt

wvd_vegt

    Master Member

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

Posted 07 November 2006 - 05:19 PM

Hi,

QUOTE (emailaya @ Nov 7 2006, 03:50 PM) <{POST_SNAPBACK}>
it causes problem that my OnChange code is executed
just when my application starts so it throws exception bcoz some of the objects were not defined yet


Seems like you assume existence of something. You could add some extra checks like

CODE
if Assigned(targetobject) then
begin
//mycode
end;


This kind of problem can also happen when you re-order the usage clauses of the dpr file for instance.
G.W. van der Vegt

#7 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 07 November 2006 - 09:00 PM

i know how to handle those situations
but i didnt handle them bcoz i didnt think this event will be triggered
just bcoz i have 1 (in this case) nxtabsheet from design time

the original pagecontrol does not trigger this event when adding new pages
(surely not when these pages are from design time)
i think u should follow this with your component

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 07 November 2006 - 09:34 PM

Hello Emailaya,

I will think about this situation a little bit more, then I will made a decision.

I will test Delphi PageControl too.

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 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 08 November 2006 - 01:36 AM

ok, thanks
ofcourse the last decision is yours
im here just to give u another point of view smile.gif

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 08 November 2006 - 01:42 AM

Hello Emailaya,

In most cases I am following standard Delphi controls, but sometime it is maybe better to have own implmentation.

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 08 November 2006 - 09:41 AM

smile.gif
about the scroller issue i told u about in another post
u said u r following VS2005 standards
and here u say sometimes it is better to have your own implementation

about the scroller issue i would agree to have your own implementation
and here i think u should follow the standard
just my 2cents

smile.gif

#12 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 10 November 2006 - 12:09 AM

sorry for bringing up this subject again
but please remove the event OnChange when creating new page in a TnxPageControl

thanks

ps: did u check regular PageControl?

#13 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 16 November 2006 - 12:16 AM

Hello,

I have fix it, but now newly created page will not become automatically active. Example:

CODE
procedure TForm1.Button1Click(Sender: TObject);
var
  Page: TNxTabSheet;
begin
  Page := TNxTabSheet.Create(NxPageControl1);
  Page.Caption := 'Laza';
  NxPageControl1.AddPage(Page);
  NxPageControl1.ActivePage := Page; // <-- need to be added manually
end;


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.

#14 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 16 November 2006 - 09:14 AM

u mean that i will need to add this line
only if i want to make the newly added page active
its not always the case smile.gif

#15 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 16 November 2006 - 03:11 PM

Hello Emailaya,

Yes, only if you need it.

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