Re: Set the CheckBox.Checked without the OnClick being called



In news:1181570444.150663.62240@xxxxxxxxxxxxxxxxxxxxxxxxxxxx,
alanglloyd@xxxxxxx <alanglloyd@xxxxxxx> typed:

Values should NEVER be allocated to Tag in the IDE, ONLY in code. With
appropriate comments if necessary.

Oh, I don't know - I use the Tag property with menus. Set the tag of each
TMenuItem in ascending order, and then use one procedure to handle all
menuitemclick() events, ie:

Procedure TForm1.MenuItemClick(Sender: TObject);
Begin

Case (Sender As TComponent).Tag of

0: // New File
1: // Open File
2: // Save File

End;

End;

Etc etc.

I know you lot will probably find that to be very much an inelegant solution
(and possibly bad form to boot), but I really like having all my menu
handlers in one proc, rather than tens of small ones. It's also useful in
that I can set the Tag property of other controls and call that procedure if
I want it to replicate a menu function when an event occurs.

The drawback, of course, is that I have to look up which tag value goes with
which menu item/control, and that the tag is then unavailable if I want it
elsewhere.

D.


.



Relevant Pages

  • Re: Clearing data from a form
    ... Dim intLoop As Integer ... Tag propertly to indicate which ones should be reset. ... put something like Reset as the tag property for each of the text boxes ...
    (microsoft.public.access.forms)
  • Re: Can you code around "Me.AllowEdits = False" for individual con
    ... Graham Mandeno [Access MVP] ... When you say "tag", is that like a smart tag or does it have some ... Every Access control has a Tag property, which you can use entirely for ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Treeview Tag loosing value
    ... And then modifying the tag using the maximum node ... But because it was sorting them it was placing them out of order. ... We are loading the data from a database and using the Tag property to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Caption in message
    ... whatever description you want in the Tag property, ... It would work if you changed the tag on every field and had ... The "caption" can be set in the table. ... Put, say, a semicolon after the asterisk, followed by the caption you wish ...
    (microsoft.public.access.formscoding)
  • Re: Storing a "pointer" in a Tag property
    ... > I want to assign an instance of a class to a Tag property and be able to ... public class Business ... ListViewItem lvi = new ListViewItem ... Tag can't cast to BusinessObject; ...
    (microsoft.public.dotnet.languages.csharp)