1 (edited by salvatorevicari85 2024-06-26 18:24:07)

Topic: Open new page of a Page Control for New Record

Greetings,
It is possible to set a function so that when you set a button in:

NEW RECORD
SHOW RECORD
Double click on a line

Open a New Page of a Page-Control, rather than a new window?

The reason is that once a new window is opened it is impossible to move the one below it, which makes the work very inconvenient.

Thank you

Re: Open new page of a Page Control for New Record

Hi,
Is this the sort of thing you need?  (see attached).
Another option for you could be to view a list of records (tablegrid) and add / edit / delete records on the same form - you don't always have to use a second form.
Regards,
Derek.

Post's attachments

Attachment icon select tabseheet.zip 444.2 kb, 53 downloads since 2024-06-22 

Re: Open new page of a Page Control for New Record

Thanks Derek. It works great

Re: Open new page of a Page Control for New Record

Another question, perhaps off topic.
In the example you uploaded, the table automatically counts the rows.
I tried to figure out how to enable or disable the row counter in the table footer:
- There is nothing in the script.
- I looked at all the options, nothing.
- I also searched the Forum. Nothing.
How do I enable or disable row counting in the table footer.
Thank you.

Re: Open new page of a Page Control for New Record

Hi,
Have a look at the attached screen shot.
You can switch footers off completely, or you can do counts, sum, average etc etc (where relevant).  Additionally, you can add text before or after the calculation (ie £: or 'No' of Contacts:) etc etc
This is also where you can align (using the 'alignment tab') tablegrid headers and column contents.
Regards
Derek.

Post's attachments

Attachment icon screenshot.jpg 82 kb, 15 downloads since 2024-06-25 

Re: Open new page of a Page Control for New Record

Found !!!
It was sufficient to enter the "Settings" of tablegrid1 and click on the mechanical wheel of the "name" column and select "count" from the formula. Perfect !!!!

7 (edited by salvatorevicari85 2024-06-25 17:38:43)

Re: Open new page of a Page Control for New Record

I'm playing around with Derek's code a bit.
I can't figure out how to write the script to hide a TabSheet, using "Visible=False" method.
I'll post the code but it's definitely wrong.

procedure Form1_Button1_OnAfterClick (Sender: TObject);                   //** switch back to the 'customer list' tabsheet after saving the record
begin
  form1.PageControl1.ActivePageIndex := 0;
    form1.PageControl1.PageIndex1.Visible  := False; <--------- ERROR -------------
end; 

8 (edited by pavlenko.vladimir.v 2024-06-25 20:10:10)

Re: Open new page of a Page Control for New Record

salvatorevicari85 wrote:

I'm playing around with Derek's code a bit.
I can't figure out how to write the script to hide a TabSheet, using "Visible=False" method.
I'll post the code but it's definitely wrong.

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=10544&amp;download=0

Post's attachments

Attachment icon 2024-06-26_01-07-51.png 10.46 kb, 14 downloads since 2024-06-25 

9 (edited by sparrow 2024-06-25 20:49:25)

Re: Open new page of a Page Control for New Record

form1.PageControl1.Pages[1].TabVisible := False;

OR

form1.TabSheet2.TabVisible := false;

Re: Open new page of a Page Control for New Record

Thanks pavlenko.vladimir.v
Thanks sparrow.   
_
I will test your solutions, hopefully tomorrow
_
I will update you.

11 (edited by salvatorevicari85 2024-06-26 18:24:25)

Re: Open new page of a Page Control for New Record

Thank you guys
I did some testing before understanding how the tool works.
Once you understand the logic it's easy to play with.
I attach my project.

Post's attachments

Attachment icon select tabseheet v.1.zip 444.66 kb, 29 downloads since 2024-06-26 

Re: Open new page of a Page Control for New Record

Hi Salvatore,
A couple of suggestions to your attached project.
1.  using a separate tabsheet just to confirm that a record has been added / changed means you are having to write extra lines of code to make the tabsheet visible / invisible.  I would suggest using 'showmessage' or 'messagebox' to achieve the same thing more effectively.
2.  when you 'add' or 'edit' a record, you could use a common procedure (in the attached example, I've called it 'customer_maintenance') rather having repeated lines of code (it means if you need to change something, you only need to do it in one place - plus it's fewer lines of code anyway).
3.  in your example, if you went into the 'Project Area' tabsheet just to view, when you clicked on the 'Home' tabsheet, it left the 'Project Area' tabsheet visible so the form behaviour was inconsisent.
4.  I noticed that you described Tabsheet1 as 'HOME  LOL' - you can actually incorporate unicode icons as part of your labels anywhere in your project.
Have a look at the attachment - but as I said at the beginning, they are just suggestions so feel free to ignore them if they are not appropriate  big_smile
Regards,
Derek

Post's attachments

Attachment icon select tabseheet v.1a.zip 444.43 kb, 30 downloads since 2024-06-26 

Re: Open new page of a Page Control for New Record

Thanks so much Derek for your suggestions.  She will treasure it. 
_
1. Yes, better messagebox, mine was just an example for practice. 
_
2. In fact, I had noticed that it was starting to become difficult to manage the code, even with just a few pages, a more dynamic and easily adaptable code would be needed, I will take a look at your project as soon as I am in front of the PC.
_
3. It was a desired effect that I tested, just go to my code and uncomment the only commented line, you will see the tabsheet pop up.
_
4. I don't know how to embed Unicode icons, I think I will find the solution in your project.

14 (edited by salvatorevicari85 2024-06-26 23:30:35)

Re: Open new page of a Page Control for New Record

Hi Derek,Hi guys,
I made some changes, The code is not dynamic but already has a repeatable structure.
_
Thanks for your common procedure "customer_maintenance", it was a good inspiration, I had to rename it to "dynamic_card_xxxx" where with xxxx I indicate the numbers of the TabSheets (the first pair of x's) and the sub TabSheets (the second pair of x's).
I commented on your "OnMouseDown", I couldn't handle it. I then inserted a new one common procedure " Close_All ".
So It is sufficient to work on the *dinamic_card* to make the project "explode" in an orderly way.
_
I made the tabs visible in the forms otherwise you can't work on them, but I make them disappear in OnShow.
_
I almost forgot; I also inserted the Unicode smileys wink
_
Thanks for your help!

Post's attachments

Attachment icon select tabseheet v.1b.zip 445.55 kb, 46 downloads since 2024-06-27