Forum Discussion
I've got the same Situation: table views with 20 lines à 45 data fields.
My solution is not to use Aliases for each control. I just use one single Alias to identify the Dialog.
The rest is done by my libraries (as You do it in Your example, too), which provide means to Access each control via caption/hierarchical location/value.
An additional Advantage is, that my Alias processing allows me to handle multiple instances of the same Dialog, which is not possible with Standard alias usage.
- John_Laird8 years agoContributor
Yeah I only use a fixed alias for navigating through sub tabs or manipulating the UI in order to get the desired control on-screen. Kind of got lazy there. For setting the controls (example SetTextBox) my code looks like this...
def setTextBox(tbRef, newValue, altref=None): rootref = Aliases.ACMConfig.frmMain.panelControl1.superTabControl1.suptabConfiguration.userControlConfiguration1.toolStripContainer2.ToolStripContentPanel.tabObjects.acmObjectView if altref == None: tbhandle = rootref.FindChild("WinFormsControlName", tbRef, 2000) else: tbhandle = altref.FindChild("WinFormsControlName", tbRef, 2000) bsList = ["[BS]"] * len(tbhandle.wText) tbhandle.Keys("[End]%s" % "".join(bsList)) tbhandle.Keys(newValue)
If the control (the name is specified in the value for the 'formprop' key) happens to be a child of rootref alias then I don't pass in 'altref', if it is not, the I pass in a alias that I can search into. Its the only way I could do it without the code turning into a giant mushroom cloud. :)
- Manfred_F8 years agoRegular Contributor
a code example from my side, "simple code":
Set myDlg = PVA_0.DialogClassJs.WrpCNew().OpenByMenu("Einrichten", "BDE-Recorder", Aliases.pva.x_MainWin.x_BdeTblEinr) ' box having caption 'Name' Set myCtrl = myDlg.Frame()("Name") ' read myTxt = myCtrl.Text
Another code example using ODT (in ODT, I define data definitions and Dialog Definitions):
' use Dialog Definition mTdP2(mcStdDlgIx) to open dialog Set BdeStdDlg = mTdP2(mcStdDlgIx).DialogOpenByButton(myRow("Bde")) ' use data Definition Td(1) to set the value defined there into the field also defined there, just Hand in the Frame as a context Td(1).SetValue BdeStdDlg.Frame()
:-)