Define variable for rooted folder

Ask general questions here.
jackrabbit
Posts: 47
Joined: Wed Mar 18, 2015 10:06 pm

Define variable for rooted folder

Post by jackrabbit » Thu Jan 28, 2016 8:59 pm

In my user code, I need to access a bunch of objects from the same rooted folder. Of cours, I can type:

Code: Select all

facture.SetFactureDiverseValues
(
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtDateEcheance.TextValue,
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtMontantDepot.TextValue,
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtNoDepot.TextValue,
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtReference.TextValue,
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtTotalAvantTaxe.TextValue,
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtTotalTPS.TextValue,
  repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses.TxtTotalTVQ.TextValue
);
As a shorcut, I decided to make this shorter with new code:

Code: Select all

var Histo = repo.Ruban.Scroller.HistoriqueFactures.HistoriqueFacturesDiverses;

facture.SetFactureDiverseValues
(
  Histo.TxtDateEcheance.TextValue,
  Histo.TxtMontantDepot.TextValue,
  Histo.TxtNoDepot.TextValue,
  Histo.TxtReference.TextValue,
  Histo.TxtTotalAvantTaxe.TextValue,
  Histo.TxtTotalTPS.TextValue,
  Histo.TxtTotalTVQ.TextValue
);

However, I always try to stay away from generic VAR definitions like "var Histo", I prefer to fully qualify every variable.  I could not find the specific definition for my Rooted Folder element that contains my objects.

I tried to find one in the Ranorex.XXX definitions, without success, is there a Rooted Folder variable type?


krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Define variable for rooted folder

Post by krstcs » Thu Jan 28, 2016 9:24 pm

Each rooted folder is it's own class, but they are all derived from RepoGenBaseFolder, which is abstract, so you can't instantiate it specifically, but you can use it as a type for passing generic folders around since they are all derived from it.

http://www.ranorex.com/Documentation/Ranorex/

Look under "Ranorex.Core.Repository namespace" tree item...
Shortcuts usually aren't...