Recent

Author Topic: [SOLVED] TECTabCtrl TabIndex bug? -> No, my fault!  (Read 1899 times)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: TECTabCtrl TabIndex bug?
« Reply #15 on: June 08, 2020, 11:12:18 am »
If you write as many bugs as I do, setting Name is also a great help when debugging, much later, code that "ought to work".

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: TECTabCtrl TabIndex bug?
« Reply #16 on: June 08, 2020, 09:46:44 pm »
Are you using this Method of creating for a new entry for the first initial one when program starts?

in other words,  you shouldn't have any pages created when program starts and this method should be called for all including the first page otherwise you'll have the first one with still the default name and when you create the next one will also still have the default name.

This method is used whenever is needed to add a page with the shopping list frame. It is the only metrhod in the whole program to achieve this. The rest of page types have their own methods (I need to polish this because I am repeating code). The default behaivour of the program is to start with an empty notebook. The user will then choose what kind of session to open:  a point of sale, customer card, diary, accounting book, shopping list.... Depending on the configuration the program will instead open a certain type of page or none. Other option could be to use a random number generator to create the name.

Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: TECTabCtrl TabIndex bug?
« Reply #17 on: June 08, 2020, 09:51:02 pm »
Actually I apply it for both page names and frame names to avoid any possibility of duplicity:

Code: Pascal  [Select][+][-]
  1. I := Notebook.Pages.Add(IntToStr(pageCounter));
  2.         newpageSHOPPINGLIST := Notebook.Page[I];
  3.  
  4.         with newpageSHOPPINGLIST do
  5.           begin
  6.              DeCodeDate (Date,YY,MN,DD);
  7.             DeCodeTime(Time,HH,MM,SS,ms);
  8.  
  9.             Name := 'pageshoppinglist' + format ('%d%d%d',[dd,mn,yy]) +
  10.                                 format ('%d%d%d%d',[hh,mm,ss,ms]);
  11.  
  12.             Caption := 'Cartera ' + '[]';
  13.  
  14.             if (tabsheetSHOPPINGLISTtheme = HDS) then
  15.             newframeSHOPPINGLIST := TFrame_shoppinglistHDSqt.Create(newpageSHOPPINGLIST);
  16.              with newframeSHOPPINGLIST do
  17.                begin
  18.                  Name := 'frame' + format ('%d%d%d',[dd,mm,yy]) +
  19.                                    format ('%d%d%d%d',[hh,mm,ss,ms]);
  20.                  Parent := newpageSHOPPINGLIST;
  21.                  Align := alClient;
  22.  
  23.                end;
  24.           end;
  25.  
  26.         Notebook.PageIndex:= I;
  27.         Notebook.Page[I].Visible :=True;
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: (SOLVED) TECTabCtrl TabIndex bug? -> No, my fault!
« Reply #18 on: June 08, 2020, 09:52:36 pm »
Thank you all for your help :-)

regards
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

 

TinyPortal © 2005-2018