Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. *Given a control such as an editline named CUSTOMER create a
  2. *button named CUSTOMER_PDI for this event. When the button is clicked
  3. *this event will lookup the binding of the associated control and return
  4. *The dictionary description for that field's binding
  5. *
  6. *PDI = POPUP Dictionary Info
  7. Case Control[-1,'B_'] = "PDI" And Event = "CLICK"
  8. Gosub popupDictionaryInfo
  9.  
  10. ...
  11.  
  12. popupDictionaryInfo:
  13.  
  14. *Get the name of the control less the _PDI suffix
  15. ControlTarget = Control[1,Len(Control) - Len('_PDI')]
  16.  
  17. *See if the control target has a bound column
  18. DictFields = Get_Property(@WINDOW : "." : ControlTarget, 'COLUMN')
  19. If DictFields EQ '' Then
  20. Msg('The control was not bound to a field')
  21. End
  22.  
  23. *Edit tables can have multiple columns bound. How many?
  24. DictFieldsCount = DCOUNT(DictFields, @SVM)
  25.  
  26. *Get the associated list of bound tables for the control
  27. DictTables = Get_Property(@WINDOW : "." : ControlTarget, 'TABLE')
  28.  
  29. FieldDescriptions = ''
  30.  
  31. *Loop through all the bound fields
  32. For i = 1 To DictFieldsCount
  33.  
  34. *Get the AMV list of table and field
  35. DictTable = "DICT." : DictTables<1,1,i>
  36. DictField = DictFields<1,1,i>
  37.  
  38. *Look-up the field description
  39. FieldDescription = Xlate(DictTable, DictField, 14, 'X')
  40.  
  41. *Construct a list of results.
  42. FieldDescriptions<-1> = DictTables<1,1,i> : "." : DictField : ":|" : FieldDescription
  43.  
  44. Next
  45.  
  46. *Display the information
  47. Swap @FM With '||' In FieldDescriptions
  48. Msg("Dictionary information:|" : FieldDescriptions)
  49.  
  50. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement