Hello,
I have a notebook with pages and this pages contain one of five possible different frames. This pages are generated at run-time.
TFrameA
TFrameB
TFrameC....
There are 5 variables to count the number of frames of a type:
ACounter: Integer;
BCounter: Integer....
This variables increase and decrease when pages are added or deleted.
Before adding a new page, it's counter will be checked to see if has arrived to the limit. If it is under the limit, the page is added containing FrameX the XCounter is updated.
(i.e: I only want to allow 2 pages with frame B opened at the same time.)
When deleting a page, you remove the page and then you have to decrease it's XCounter.
Heres the problem. I am not sure how to attach the event of deleting the page and decreasing the XCounter.
I was thinking in the following solution:
When clicking the delete page button, the pseudocode to execute would be something like this:
onclickDeleteButton()
if Page contains Frame =isInstanceOf(TframeA) then decreaseCounterA();
if Page contains Frame=isInstanceOf(TframeB) then decreaseCounterB();
(...)
The Question:How I do this in Pascal? I need to access the (unknown) frame inside a known page (Notebook.Pages.Item
) and type cast it to check if it belongs to TFrameA, TFrameB....