Bound controls on a form (OpenInsight 32-Bit)
At 22 JUN 2005 10:05:57AM B Cameron wrote:
What is the best way to get a list of the bound controls on a form without starting the window so that I can get the dict item name from the control as well as the table name.
I know I can use the CTRLMAP but I do not want to start the window. I would rather select all SYSREPOSWINS that match a table and then read that record.
At 22 JUN 2005 11:52AM Bruce Cameron wrote:
Ok, I get it… sometimes I have to ask the question in fairness to the client I am working for to get something done quick so I came to this well first, but… anyway here is what I did… any comments, pot shots, bugs feel free…
From system editor exec line
RUN FIND_MISSING_DICTITEMS "YOURAPP","ATABLE"
Function Find_Missing_DictItems(AppId,Table)
*
* B. Cameron.
* Function to locate any form bound dict items missing in system.
*
Declare Function Get.Reccount
*
If Assigned(AppId) Else AppId=" ; If AppId=" Then AppId=@APPID
If Assigned(Table) Else Table=" ; If Table=" Then Call Send_Dyn("Need table var.") ; Return ""
*
Open "SYSREPOSWINS" to SWFile Else Call Send_Dyn("Could not open SYSREPOSWINS.") ; Return 0
*
For x=0 to 8 ; ClearSelect x ; Next x
Totsw=Get.RecCount(SWFile,Flag,0)
*
ValidCtrls=EDITFIELD EDITTABLE LISTBOX COMBOBOX RADIOBUTTON CHECKBOX VSCROLLBAR HSCROLLBAR"
*
Select SwFile
Eoj=0
Cnt=1
DList="
Loop
ReadNext Id Else Eoj=1Until Eoj=1 Do
Call Send_Info(Cnt:" of ":Totsw:" - ":Id) ; Cnt += 1App=Field(Id,"*",1)WinId=Field(Id,"*",3)If App=AppId ThenRead SWItem from SWFile,Id ThenIf index(SWItem,Table,1) ThenTotR=count(SWItem,@FM) + (SWItem # "")TotRx= TotR - 2For Val=4 to TotRxIf index(ValidCtrls,SWItem,1) Thentbls="tbls=SWItemtbls=SWItemconvert char(251) To @VM in tblsTotC=count(tbls,@VM) + (tbls # "")For valc=1 to TotCtname=tblsditem=tblschk=xlate("DICT.":tname,ditem,"","X")if chk=" thenlocate ditem in dlist using @FM setting pos elsedlist=ditemdlist=tnamedlist=winidendendNext ValcEndNext ValendendEndRepeat
totd=count(dlist,@VM) + (dlist # "")
For row=1 to totd
call send_dyn(fmt(dlist,"L#30"):" ":fmt(dlist,"L#20"):" ":dlist)next row
*
RETURN ""
Could be modified for more robust purposes but for a start will list items.
At 22 JUN 2005 11:56AM Bruce Cameron wrote:
The line
locate ditem in dlist using @FM setting pos else
should be @VM not @FM.