Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Usersession and procedure question
#3
Hi Jose,

Thanks for your input. That's the way I use when defining classes. What I'm looking for is a bit more classic:

I have a rec defined in UserSession:

ItemRec = Record // could be a class I know
ItemNo : integer;
ItemName : string
end;

I have 3 databases DB1, DB2, DB3 which all has an Items table. The items table has a record structure like my ItemRec. I use the 3 databass in 3 different forms, F1, F2 and F3.

I only have one form open at a time and when opening a form, I read an item from the database (from DB1 when it is Form1 and so on) and temporary save the Itemno and ItemName in Usersession.ItemNo and UserSession.itemname. And to make sure, UserSession.ItemNo and .Itemname are empty before I use them, I add the lines:
Usersession.ItemNo := 0; and UserSession.ItemName := ''; to the formshow event of F1, F2 and F3.

So in all 3 forms, I have the same 2 lines in the Formshow event.

What I'm looking for is a way to keep the emptying in UserSession, or somewhere else, in a procedure like InitializeItemRec; and instead of the 2 lines in every FormEvent, I just call usersession.initializeItemRec; or {unitname}.initializeItemRec;

My problems is I cant see where to put such an initialize procedure.

Regards
Soren
Reply


Messages In This Thread
RE: Usersession and procedure question - by SorenJensen - 01-29-2020, 03:24 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)