The Init code that runs is always from the page class unless you have the chance of setting it up before the PageFrame is instantiated. It must be part of a class.
You have two ways of doing this that I know of.
In a PRG:
[Start of code] LOCAL Test AS FRM
m.Test = CREATEOBJECT("FRM") m.Test.Show(1)
DEFINE CLASS FRM AS Form
ADD OBJECT PGF AS PGF1 WITH PageCount = 3
PROCEDURE PGF.PG1_3.Init MESSAGEBOX("It fires!") ENDPROC
ENDDEFINE
DEFINE CLASS PGF1 AS PageFrame
MemberClass = "PG1_" MemberClassLibrary = SYS(16)
ENDDEFINE
DEFINE CLASS PG1_ AS Page
PROCEDURE Init MESSAGEBOX(TEXTMERGE("Initing page <<This.Name >>")) ENDPROC
ENDDEFINE [end of code]
Visually, as it is the case in your scenario, save your form as a class with the init code of the pages in place. Then, create your actual form from the class. The Init of the pages will fire.
On Thu, Jul 4, 2019 at 5:50 AM MB Software Solutions, LLC < mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
Sadly, yes...just confirmed after I stuck obvious label on to test that theory: https://www.screencast.com/t/WgGyQIBhNGSV
My money is on the order of records in the SCX table causing something hokey here.
On 7/3/2019 10:10 PM, Frank Cazabon wrote:
But if you make a visual change to that page and then run the form
again, is your visual change there?
On 3 July 2019 22:00:06 GMT-04:00, "MB Software Solutions, LLC" <
mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
Frank -- Yep. That frmEditJob is the most popular form in this app. In the demo, I edit that form, save it, recompile all files with immediate
run, then run the code that runs that form.
Tracy -- yeah I wondered that too. Pageframe is using my pgfbase class, which has a MemberClass of pagbase and MemberClassLibrary of e:\dev\fabnet\classes\mjbbase.vcx. Using the SCX like a tab, here is the Properties of that main pgf:
ErasePage = .T. PageCount = 13 Anchor = 15 ActivePage = 1 Top = 0 Left = 0 Width = 888 Height = 600 TabIndex = 1 Name = "pgf" Pagbase1.Caption = "Job Info" Pagbase1.PageOrder = 1 Pagbase1.ToolTipText = "General Job Information" Pagbase1.Name = "pagJobInfo" Pagbase2.Caption = "People" Pagbase2.PageOrder = 3 Pagbase2.ToolTipText = "Key people assigned to roles for this Job" Pagbase2.Name = "pagPeople" Pagbase3.Caption = "Notes" Pagbase3.PageOrder = 4 Pagbase3.ToolTipText = "Various notes for this Job" Pagbase3.Name = "pagNotes" Pagbase4.Caption = "Recipients" Pagbase4.PageOrder = 5 Pagbase4.ToolTipText = "Proposal report receipients (possibly customers
or general contractors)" Pagbase4.Name = "pagRecipients" Pagbase5.Caption = "Items" Pagbase5.PageOrder = 7 Pagbase5.ToolTipText = "Items for this Job" Pagbase5.Name = "pagItems" Pagbase6.Caption = "Fees/Discounts" Pagbase6.PageOrder = 6 Pagbase6.ToolTipText = "Fees for this Job" Pagbase6.Name = "pagFees" Pagbase7.Caption = "Rates" Pagbase7.PageOrder = 2 Pagbase7.ToolTipText = "Rates for this Job" Pagbase7.Name = "pagRates" Pagbase8.Caption = "Special Rates" Pagbase8.PageOrder = 8 Pagbase8.ToolTipText = "Special rates placeholders" Pagbase8.Name = "pagSpecialRates" Pagbase9.Caption = "Access" Pagbase9.PageOrder = 10 Pagbase9.ToolTipText = "User access history to this Job" Pagbase9.Name = "pagAccess" Pagbase10.Caption = "Dates" Pagbase10.PageOrder = 9 Pagbase10.ToolTipText = "Key dates for this Job" Pagbase10.Name = "pagDates" Pagbase11.Caption = "Differences" Pagbase11.PageOrder = 11 Pagbase11.ToolTipText = "Factor/Rate differences across the job (checking for outdated pricing)" Pagbase11.Name = "pagDifferences" Pagbase12.Caption = "Released" Pagbase12.PageOrder = 12 Pagbase12.Name = "pagReleased" Pagbase13.Caption = "Billing" Pagbase13.PageOrder = 13 Pagbase13.Name = "pagBilling"
Like I said...other pages besides pagReleased and pagBilling seem to have their Init events respected. One interesting note though: I put a MESSAGEBOX in one of the page.Init's that is working correctly, and the
msgbox DID NOT SHOW. The line afterwards to RETURN SomeFalseCondition did work though, as the page properly didn't show then. WEIRD!!!!!!
On 7/3/2019 4:27 PM, Frank Cazabon wrote:
Are you sure that what you are running is what you are editing?
On 3 July 2019 16:03:21 GMT-04:00, "MB Software Solutions, LLC"
mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
I added 2 pages to my existing pageframe so that I could add more functionality to this form. There are pages that I conditionally instantiate based on user settings. But for these 2 new pages (automatically added via the IDE after I set the pageframe.PageCount from 11 to 13), their Init events never run. I'm baffled. See soundless Camtasia demo I put together to show this: https://www.screencast.com/t/eZ1EyfDewnw
I'm hoping somebody can see something obvious that is eluding me!
tia, --Mike
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
[excessive quoting removed by server]