Forum Discussion
John_Laird
9 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_F
9 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()
:-)