We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

XP MenuItem as PopupContainer ParentControl

Hi, guys -- I''m developing an application where I''d like to have a toolbar icon that, when the user clicks on it, displays a custom color picker. (We''re making some modifications to the Syncfusion one.) Imagine you''re using Microsoft Word. You click on the "A (color)" toolbar icon to change the text color. Word pops up a small window holding a basic set of colors immediately below the toolbar icon. It seems like setting the PopupContainer''s ParentControl to the XP MenuItem that was clicked on would do it. Unfortunately, the PopupContainer won''t accept an XP MenuItem as a valid ParentControl. Alternatively, I thought I''d just get the X, Y location of the bottom-left corner of the XP MenuItem and pass it to the PopupContainer as the location to show itself. Unfortunately, I can''t seem to find a way to get the X, Y location of the XP MenuItem, either. Would y''all have any ideas on how to solve this challenge? I must be overlooking something... Thanks! Anthony

12 Replies

AD Administrator Syncfusion Team March 4, 2004 08:57 PM UTC

Hi Anthony, You could use the DropDownBarItem in your ToolBar for this purpose. The DropDownBarItem has a PopupControlContainer as its child control, and you could display the ColorPicker control in this. Please refer to the sample attached here which shows how this can be done, and let me know if it meets your requirements. Thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AH Anthony Hand March 5, 2004 12:28 AM UTC

Thanks, Guru! I totally forgot that that type of MenuItem existed. Sorry about that! Cheers, Anthony


AH Anthony Hand March 5, 2004 10:11 PM UTC

I have another question for you, Guru. I want to have multiple DropDownBarItems share the same color popup (all 4 are for color -- one each for text, lines, fills, and shape shadows). I''d prefer to avoid putting the same control on 4 times and providing separate wiring instructions for each instance. To do this effectively, I need to find out which of the 4 DropDownBarItems was clicked on, then use that info to send in the current color, modify the text, and customize the behavior of the color picker control. After the user clicks on a color, a different coloring action happens depending on which BarItem was originally clicked. It seems like the logical way to do this would be to capture when the end user clicks on that little dropdown-style triangle next to the BarItem and use that knowledge to customize the behavior of the color popup. However, there doesn''t seem to be a way to capture when the triangle itself is clicked on. Am I overlooking something? As you know, clicking on the triangle launches the popup, but that event appears to be inaccessible. The DDBarItem''s "Click" event only fires if the BarItem itself is clicked on -- it doesn''t fire when the triangle is clicked on. The DDBarItem''s "IsSelected" event fires any time there''s a mouseover over the BarItem. Any ideas? Thanks! Anthony


AD Administrator Syncfusion Team March 8, 2004 11:33 PM UTC

Hi Anthony, Thanks for bringing this to our attention. I too could observe the above mentioned problems with the Selected and Click events. I have consulted the development team for their inputs on this issue and will update you as soon I hear from them. We appreciate your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team March 9, 2004 02:47 PM UTC

Hi Anthony, You could use the following workaround for this purpose - Handle the PopupControlContainer''s BeforePopup event as shown below : private void popupControlContainer1_BeforePopup(object sender, System.ComponentModel.CancelEventArgs e) { MenuGrid menu = this.popupControlContainer1.PopupParent as MenuGrid; if(menu != null) { /* The DropDownBarItem "selected" will indicate the the DropDownBarItem used to display the ColorUIControl */ DropDownBarItem selected = menu.SelectedItem as DropDownBarItem; } } I have also attached a sample application that illustrates the above. Please let me know if this meets your requirements. Regards, Guru Patwal Syncfusion, Inc.


AH Anthony Hand March 15, 2004 11:05 PM UTC

Thanks, Guru! This will work for now. I hope that you guys will add an appropriate event to the next version, though. Thanks, Anthony >Hi Anthony, > >You could use the following workaround for this purpose - Handle the PopupControlContainer''s BeforePopup event as shown below : > >private void popupControlContainer1_BeforePopup(object sender, System.ComponentModel.CancelEventArgs e) > >{ > >MenuGrid menu = this.popupControlContainer1.PopupParent as MenuGrid; > >if(menu != null) > >{ > >/* The DropDownBarItem "selected" will indicate the the DropDownBarItem used to display the ColorUIControl */ >DropDownBarItem selected = menu.SelectedItem as DropDownBarItem; > >} > >} > >I have also attached a sample application that illustrates the above. Please let me know if this meets your requirements. > >Regards, >Guru Patwal >Syncfusion, Inc.


AH Anthony Hand March 15, 2004 11:56 PM UTC

I keep responding to these a little too early... :-) Okay, here''s the problem. When a DropDownBarItem is hosted in a Main Menu, its PopupParent is a MenuGrid, as noted in the sample. However, once you move the DropDownBarItem to a toolbar, its PopupParent becomes a SingleLineBarRenderer. As a result, the code in the sample provided above won''t work when the DDBarItem is hosted in a toolbar. The SingleLineBarRenderer doesn''t appear to have any reference to the selected BarItem. Any other ideas? Anthony


AD Administrator Syncfusion Team March 17, 2004 07:49 PM UTC

Hi Anthony, Presently, it is not possible to use the same logic if the DropDownBarItem is present directly on the ToolBar. Because like you mentioned above, DropDownBarItem PopupParent is a SingleLineBarRenderer in this case. For this purpose we will add a SelectedItem property (considered as a feature request) to the BarRenderer at the earliest. We appreciate your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.


AH Anthony Hand March 24, 2004 10:35 PM UTC

Hi, Guru -- It might be useful to add a SelectedItem to the BarRender. But it would be even more useful to have that little downward-facing triange widget generate a click event that can be captured. That''s what started this whole thread -- The DDBarItem''s triangle widget doesn''t currently generate any such event. If it did, I could capture it if I knew which DDBarItem it was associated with, and apply some logic to it. So please add that as a feature request, as well. Thanks, Anthony


AD Administrator Syncfusion Team March 25, 2004 11:31 PM UTC

Hi Anthony, I have updated the above QA report (QA# 435) with your suggestion regarding the click event for the dropdown button. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


MM Magdalena Magdalena June 10, 2009 03:11 AM UTC

Hi there Guru,

I'm in the middle of doing a similar project to what Anthonny is doing here.
Would you mind posting the sample applications again posted in this thread, as whenever I try to download the attachments, the files are not found.

Thank you!

Magdalena


FS Fathima Shalini P Syncfusion Team June 10, 2009 01:22 PM UTC

Hi Magdalena,

We regret for the inconvenience caused.

Kindly refer to the provided link that gives the sample posted above:

http://syncpatch.syncfusion.com/web/support/user/Uploads/popup_colorpicker_modified_1554.zip

Currently we are working in re-directing the links provided in the forums. So the links in the forum will be accessible soon.

Please let me know if any concerns.

Regards,
Fathima

Loader.
Live Chat Icon For mobile
Up arrow icon