create control array

Is it possible to create a control array; e.g., a set of static text controls which allows for a single event (e.g., a mouse right click event)that provides an index number identifying which specific control in this array has been clicked. This feature would save a tremendous amount of coding by eliminating the need to have a separate event coded for each control.

VB6 had this capability but VB2010 (what a nightmare!) doesn't seem to have it.

Comments

sys_event control array

This could be done by modifying the TrueCTRL library module rather than trying to break into the actual SYS_EVENT sub-routine. I suspect that a simple 4 digit number consisting of two parts would do the trick. The first two digits would refer to the control object, e.g. menus or push buttons or scrolls etc. The second two digits would refer to the type of action, e.g. single click, double click, dragging etc. It might even be possible to use a two digit number where the first digit defines the control object and the second the type of action. This might limit the options with the extended version of TrueCTRL i.e. the CTX library that has many more control objects. In CTX even static text boxes are control objects. I will look into this but don't hold your breath.

CONTROL ARRAYS

Hi,

The way that TrueCTRL keeps track of various control objects is not accessible by the user, whereas the CTX library module does keep an internal array of all controls and objects. In fact CT_event returns the ID (array reference number) when an object is clicked. This internal array is two dimensional with 20 elements in the second dimension for storing data about each object such as its co-ordinates, pen and paper colors, the font details etc. The user can access these elements in the array with CT_get and CT_set.

Control arrays

Ho Tom,

Thanks for pointing out the real problem. I obviously got the wrong end of the stick. There is no problem with creating a control array in the CTX library, but it will be a problem with TrueCtrl simply because Static text objects don't respond to mouse clicks whereas CTX text objects do.

In CTX I think the right approach would be to create a new object, e.g. a TextArray object that works in virtually the same way as radio buttons. This is a simple task to implement. Would anyone else find this new object of interest?

Regards
Big John

Control Arrays

Big John, I don't think you quite understood the question. A control array is a group of controls, only one of which is active at any one time (think radio buttons) When you select one of the controls in the group, the others are automatically deselected. This is a property of the control array. You don't have to manually deselect the other items. The entire group only has one value - the value of the currently selected control in the group.

Static text objects in TrueCtrl

Hi,

The static text object in the TrueCtrl library does not produce an "event" when clicked. Clearly, if there is no "event" then you cannot process any data to determine which object was clicked.

However, the CTX library module essentially reproduces all the objects available with TrueCtrl, but in the case of CTX all objects (including Static text objects) produce "events" when clicked. As a result you can use an array to store the object ID numbers.

Regards
Big John