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.
Unfortunately, activation email could not send to your email. Please try again.

XP MenuItem as PopupContainer ParentControl

Thread ID:

Created:

Updated:

Platform:

Replies:

11402 Mar 4,2004 03:06 PM Jun 10,2009 09:22 AM Windows Forms 12
loading
Tags: Tools
Anthony Hand
Asked On March 4, 2004 03:06 PM

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

Administrator [Syncfusion]
Replied On March 4, 2004 03:57 PM

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.

Anthony Hand
Replied On March 4, 2004 07:28 PM

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

Anthony Hand
Replied On March 5, 2004 05:11 PM

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

Administrator [Syncfusion]
Replied On March 8, 2004 06:33 PM

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.

Administrator [Syncfusion]
Replied On March 9, 2004 09:47 AM

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.

Anthony Hand
Replied On March 15, 2004 06:05 PM

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.

Anthony Hand
Replied On March 15, 2004 06:56 PM

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

Administrator [Syncfusion]
Replied On March 17, 2004 02:49 PM

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.

Anthony Hand
Replied On March 24, 2004 05:35 PM

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

Administrator [Syncfusion]
Replied On March 25, 2004 06:31 PM

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.

Magdalena Magdalena
Replied On June 9, 2009 11:11 PM

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

Fathima Shalini P [Syncfusion]
Replied On June 10, 2009 09:22 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;