I'm having exactly the sample problem - no operations are shown for a given role. Seems like a bug to me....
robalexclark
Posts
-
AzMan Roles and Operations -
Complex user control not responding to click eventsHi, I also had the samBtn.Click+=....in the loop attaching a common handler each button ...to no avail. However your comments got me thinking about exactly what was happening (in terms of only 1 event and overlapping controls) and I think I realise why its not working. The problem is that I have a usercontrol that is *full* of buttons. When I added the buttonArray1.Click+= part to the user control and hopeing to catch this, it was not firing because that would *only* fire if I clicked on an *empty* part of the userControl and not a button. If I click on a button, then that SampleButton "most deserves it" and deals with it correctly (it changes colour). As there is no part of the user control that is empty, its never going to work. Maybe what I need to do is raise a new event from the change colour event and catch that in my main form. Thanks again, Rob
-
Complex user control not responding to click eventsHi, Thanks for your reply Luc. I added the code to add event handlers for each button and tested the event within the User Control designer and all seems fine there. However, when I add a Button Array to a windows form, and create a Click event for the whole array: private void buttonArray1_Click(object sender, EventArgs e) { MessageBox.Show("Button array has been clicked"); } (and this.buttonArray1.Click += new System.EventHandler(this.buttonArray1_Click) in the initialiseComponent method) This event does not trigger. This was one reason why I added the OnClick method to the ButtonArray control as I thought that by doing this it would allow clicks on the ButtonArray to be handled within my form (my logic is probably completely wrong here) Thanks again, Rob
-
Complex user control not responding to click eventsHi all, I'm wondering whether any of you people can help me out with this problem that I have with a user control that I have been trying to get working. The first part of the user control is a flat circular button ( called SampleButton) that toggles colour when clicked. This control has an OnClick method as follows protected override void OnClick(EventArgs e) { base.OnClick(e); (code to change colour and call invalidate....) } Then, from this I am creating a matrix of these buttons in another user control that inherits from SampleButton (which in turn inherits from UserControl), e.g. a 3 x 3 matrix, like so: O O O O O O O O O I do this using a couple of for loops (the number of SampleButtons has to be dynamic), a bit like: for (int i = 0; i <= 2; i++) { for (int j = 0; j <= 2; j++) { SampleButton samBtn = new SampleButton(); samBtn.Location = new Point(i, j); this.Controls.Add(samBtn); } } } In this control I have an OnClick method: protected override void OnClick(EventArgs e) { base.OnClick(e); MessageBox.Show("The Sample Button Array has been clicked"); } The problem is that although when I click on the array of sample buttons, their colour changes (so the first OnClick method is running ok), the messagebox never appears (the method is never entered). Why does this second OnClick method never get called? Thanks, Rob