Sets or returns the property of the buddy control that is to be modified.
object.BuddyProperty as String
The BuddyControl property specifies another control on the form that will update when this control is clicked. When this property is set, clicking on the active control will modify the contents of it's buddy control also. Some host-generated controls, such as menu buttons and option buttons have automatically populated buddy properties . These controls have one thing in common, they are usually part of a group of individual controls that are associated with a single entry field. The buddy processing determines what value to send to the entry field and which field to send it to.
A buddy control can be specified using either the control name, or the row and column position of the corresponding host field using the following syntax:
row,column
The BuddyProperty is the specific property of the buddy control that will be populated with the value of the active control when clicked.
If you specify the BuddyControl property you will need to also set the BuddyProperty property. Where the BuddyControl is a textbox, the BuddyProperty is typically set to Text
. If the BuddyControl is a label, then the BuddyProperty is usually set to Caption
.
If the BuddyValue property is left blank then the value sent to the buddy control will be the current value of the active control. If a BuddyValue is specified then the specified value will be sent to the buddy control when the active control is clicked.
For CheckBox controls the BuddyValue property can be specified as two values. The first value is used when the check box is checked and the second value is set when it is cleared. The two values are specified using a semi-colon to separate them like the following example:
checkedValue;uncheckedValue
If a BuddyKey is specified, then, after the active control is clicked, the focus will be moved to the buddy control and the specified AID key will be sent to the host when the buddy control is modified.
Buddy processing is tied to the click event of the active control, therefore setting a buddy control does NOT mean that the two controls are synchronized. The buddy control is only updated when the user clicks on the active control. Any changes to the value of the active control via other means, for instance a script or macro, will not modify the buddy control.
Let's take a look at a host screen example. The "DocSighted" field at the bottom of the screen below is a perfect candidate to be replaced with a check box. The field accepts two possible values and a checkbox would ensure that users enter an accurate value into the field. The value of this check box however needs to populate the host-generated "DocSighted" field. We could do this by writing a macro or script to populate the control but the easier method is to assign a buddy control to the inserted check box.
Here's how we could go about it:
False.
20,23
(which is the row, column co-ordinates of the field), or to the name of the field DocSighted
.Text
.Sighted;Unsighted
as the BuddyValue.Now when the user clicks the new checkbox the text "Sighted" will be sent to the hidden DocSighted entry field and the text "Unsighted" will be sent when the user un-checks the control.
BuddyControl property | BuddyKey property | BuddyValue property | Properties
CommandButton control | Check box control | PicutreBox control | Label control | Menu button control | Option button control | UpDown control
© 2004-2021 looksoftware. All rights reserved.