tone_crafter 0 Newbie Poster

I have a string grid that I am setting the number of rows dynamically. Therefore I am creating an array of TUpDown arrows dynamically and placing one in each cell within a column.

My problem is that I want each UpDown arrow to have the same event handler. I can set the event handler but when I make the string grid the parent of the UpDown arrows the event handler won't go off when I click the arrows. If I make the form the parent of the arrows it works fine.

How can I set the string grid to be the parent and use the event handler I have written? Here's the code:

cell_num = 0;
	while(cell_num < (total_channels - 1))
	{
		for(char x = 0; x < 16; x++)
		{
			if(midi_channels_used & (0x01 << x))
			{
                                UD_PC[cell_num] = new TUpDown(StringGrid_preset);
                                UD_PC[cell_num]->Width = 17;
				UD_PC[cell_num]->Height = StringGrid_preset->RowHeights[1];
				UD_PC[cell_num]->Top = (StringGrid_preset->DefaultRowHeight+1) * (cell_num+1);
				UD_PC[cell_num]->Left = StringGrid_preset->ColWidths[0] + StringGrid_preset->ColWidths[1] + StringGrid_preset->ColWidths[2] + 3;
                                UD_PC[cell_num]->Parent = StringGrid_preset;
                                UD_PC[cell_num]->Associate = NULL;
                                UD_PC[cell_num]->Refresh();
                                UD_PC[cell_num]->OnClick = DynamicUpDownClick;
                                cell_num++;
			}
		}
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.