I have a problem with a view/window that has a tree view on the left then a list style view on the right which displays "stuff" corresponding to the tree node selected on the right. Very similar to how windows explorer looks and works.
The "stuff" can be displayed as a list, large icons or small icons or information.
The problem I have is that if one of the tree nodes selected is a 'placeholder' node, then 'select all' is run from the Edit menu, then after that the 'delete' option in the Edit menu is greyed out even though all the items in the RHS view are marked as selected and can in fact be deleted safely.
This can be fixed by selecting away from the tree node to another node, selecting back to the same tree node, then selecting a different view: List, large icon, small icon, or info view than was originally selected.
Trace statements show me that in the second working, scenario, the items in the right hand view are being passed to a "can I delete" function whereas when things dont work it is the name of the tree view node that gets passed to the "can I delete" function. when the "can I delete" function returns true, the 'delete' option is enabled in the Edit menu and when false it isnt.
Is there a way I can force the 'focus' for want of a better word to the right hand list, info, etc view when 'select all' is selected from the Edit menu to make this work ok all the time?
I think the problem is that the Edit menu is different (context sensitive) depending on which view ('it' thinks) is active and somewhere wires are crossed and the Edit menu is being displayed for the tree view when it should be for the RHS node list view. It is figuring out how to fix this i am struggling with.
Thanks
You have problems with the MFC command routing.
Check where you placed the handler for the commands.
A command handler is searched in this sequence:
Active view
Document
Document template
Frame window
Application.
I suppose you have handler in the views, and the focus (active view ) changes
You can change the command routing i.E. in the frame and ask all views attached to the document to handle a command... you have to overwrite OnCmdMsg for this.
See more details here
Related
Is it possible to change the way items in the content tree are rendered in Sitecore?
In Umbraco, there's the option to render all child items of a parent node as either child nodes or in a list view outside of the tree. Next to the tab(s) belonging to the parent node, a node "child items" is added. In this node, all child items are rendered in a listview, supporting popular features like paging, sorting and search.
Is this possible in Sitecore?
Upon searching for an answer to this question, the most common reply is to use a bucket. However, when using a bucket, a message appears instead of the child nodes: "There are hidden items in this container". In a new tab next to the standard Content tab, the end user can search for a child item, but it doesn't seem to be possible to show a listview/grid.
So the question remains:
Can we render content tree subitems in a list/grid, in a new tab next to the Content tab, using features like paging and sorting.
Many thanks.
You can define a default query for your bucket. After that, when a user clicks on the bucket item, he will see search results right away in the form of a list.
Here's documentation on how to do this:
https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/search_and_indexing/create_a_default_and_a_persistent_search_query
In short, you just specify your query in the field Default bucket query of the bucket item.
I am not aware of any other way of achieving what you want. Sitecore content editor just doesn't have this feature from Umbraco.
You may want to take a look at the Subitem Express module.
It does not offer features such as a sorting, paging or searching, but it will display and allow editing of children from a single content editing pane, as well as allowing adding new and deleting children. The child items can also be hidden so that they are not visible in the tree by default, but you can enable "hidden items" to still edit the children like regular items.
Really depends on your requirements, but I've used the module for data heavy items where it was easier to enter through the Content Editor than all the fluff around the Experience Editor to speed data entry.
We have a rendering listing the selected items in a TreeSelect in the current item. In our case we call them "Tags" (1)
We have added a Field Editor Button to the component to let the editor change selected items. (2) (As described on for example Adding a custom component)
When an editor clicks (2) the editor window (3) it is opened in a dialog. The editor may select different items(called tags in our case) using the TreeSelect.
When the editor presses the ok-button (4) the values are set.
Now to the problem:
The values are actually set as they get stored when the editor presses the Save button but we want our list on the page (1) to immediately reflect the set items when the editor presses the ok-button (4), i.e. before having to actually save the whole item.
How do we achieve that?
(I am in contacts with Sitecore support but so far I have not gotten any answers...)
Update
After a lot of conversation with the support we still have no useful solution.
We tried turning it into a field renderer displaying the links.
What worked was:
The field do get updated when you have edited it in the popup field editor. (but...)
It looks good the first time when page is loaded.
You can make a WebEdit button with commands to edit the field and add it as Custom button to the field (register <command name="webedit:fieldeditor" type="Sitecore.Shell.Applications.WebEdit.Commands.FieldEditor, Sitecore.Client"/> and set Click on the button to webedit:fieldeditor(command={3473DDA1-2983-493C-AF7A-054C75AA7AD3},fields=NameOfField where the guid points to itelf and an "Icon" is set on it.)
What didn't work was:
The field get updated by the raw value, not what I want to display. Server code is involved, but not in the rendering of html-code.
When I want to edit the value in the field editor, the value sent to the field editor is not the raw value but what actually is displayed on the page. (I guess this can be solved somehow)
The issue to the support turned into a feature request to let the server be involved in rendering the field, not just sending a new value to the JavaScript updating it. The server does the first rendering so when it already is involved in updating, it should be allowed to do the rendering the following times too.
We have decided to not spend more time on this right now (we have other things to do too.) and have a bad editor experience as the field not get updated until the editor actually saves the item.
Still we have no suitable solution for this issue. If you want to keep working on it and want a reference to my issue it is 439059.
This may not be useful here. I've done this in normal sites, but not in Sitecore. But, here's one possibility....
This is a situation where you would pass a callback function to the child popup window. This callback will cause the caller / parent window to re-read/re-load the information that was just updated by the child.
Example:
User presses (2) to open Editor Window(3) (Editor window is opened and the Callback function is passed as a parameter)
User presses "OK" button (4). The "OK" button event handler updates the changes, then calls the Callback function which re-loads the now updated information, and closes the popup window.
Once the popup closes, the parent window now displays the information that the popup/editor just updated.
This takes some client side javascript (jquery) development but it is quite do-able normally.
We have a list that uses a custom renderer containing a label, a checkbox and two icons (which have click events). This list needs to be made WCAG 2.0 compliant and in order to do that we need the list to be keyboard navigable.
The problem is with being able to move from one list item to the next and have the focus move to the label for the next/previous list item. Specifically, when the user enters the list using TAB button, the label for the first list item receives focus (highlighted box around text) and the entire row in the list is highlighted as the selected item.
However, when the user then presses the down arrow key to move to the next list item, the next row becomes highlighted (is now the selected item) but the focus remains on the label of the previous row (highlight still shown around label for row 1). The only way to get the focus to move to the newly selected row is to tab through the checkbox and two icons. This isn't a big deal if there are only a couple list items but would be a pain if there are 20+ rows in the list.
Is there a way to get the focus to move to the label of the newly selected row as soon as the user moves (using up/down cursor keys) to the new list item? I know a picture would help but I don't have anyway of posting a screenshot online. Any help would be greatly appreciated.
You're going to have to dig into how focus works in Flex. This is not a complete answer, but hopefully you can put together a solution that works for you. I did this about 4-5 years ago in Flex 3, but it should be similar in Flex 4.
How Focus Works in Flex
The main things to know are the FocusManager singleton class and the IFocusManagerComponent interface.
The FocusManager moves the focus around the UI based on user interactions (mouse clicks, keyboard navigation, etc.).
If a component implements the IFocusManagerComponent interface, then the FocusManager will include it in the "tab" loop and allow the component to be focused via keyboard navigation.
How Focus Works With Flex List Components
You've already stumbled onto the peculiarities of how focus works with the List component and item renderers. The Flex List components implement IFocusMangerComponent and so when you tab through the UI the FocusManager sends the focus to the list.
The List may or may not focus the item renderers. In Flex 3 you had to be using editable item renderers for this to happen, it may or may not be the same in Flex 4.
Some Ideas for Solutions to Your Problem
I think there are numerous ways to solve this. Use some combination of these techniques:
override the protected keyDownHandler() method of the List component. I don't have the code handy, but if you look at it's implementation in the List class you should be able to make your overridden version set the focus on the next renderer.
use methods of the FocusManager to find components in the tab loop: getNextFocusManagerComponent(), findFocusManagerComponent(). Check the docs there are others that will be useful. For example, when the user presses the down arrow, you can let the next item renderer get selected, then use findFocusManagerComponent() (passing in the newly selected renderer) and then tell the FocusManager to focus it with the setFocus() method. This is probably not exactly the right approach ;)
By the way, the FocusManger is a Flex singleton object, every UIComponent in Flex has a focusManager property you can use to get a reference to it.
consider disabling focus on objects that don't need to receive focus (like the Label in your item renderer). There are numerous properties to do this: focusEnabled, hasFocusableChildren, mouseFocusEnabled, tabEnabled, tabChildren etc.
consider disabling focus on the List component, but then making your item renderers implement the IFocusManagerComponent interface. Implementing the interface is simple, you just declare it in your class (there's no actual methods to implement). The tricky part will be now your item renderers need to have key down handlers (just override the protected keyDownHandler() method that all UIComponent objects have).
I think there are other techniques you can use, it's just been too long since I did this. I'd be happy to provide more help if you get stuck somehwere...
I have a list, I want to open a View/Panel when "itemtap" event is fired (i.e. when a list item is selected). How to do it? Shall I use NestedList and getDetailCard() for it?
Thanks
EDIT : I think I should use CardLayout for it.
It depends on your situation.
If the new content you are trying to display is supposed to be replacing content on the screen, that yes using the CardLayout is the best option. This would be akin to emulating something like the UISplitViewController in the iOS world, where you have a list on the left and a main view on the right in which additional content is slid onto the screen based on actions to the right list.
So, on response to 'itemtap' events in the list you would do a 'setActiveItem' call to the panel that has a layout of card layout, and a series of children panels. You could also lazily create the panels in response to the list actions and add them on the event.
I've got a MFC CTreeCtrl stuck in a dialog with the TVS_CHECKBOXES style turned on. I get checkboxes next to all my tree items fine. In OnInitDialog I set the checked state of some of the items using CTreeCtrl::SetCheck but none of the items in the tree are checked when the tree is displayed. SetCheck is returning TRUE. Checking items with the mouse works fine. Anyone encounter this before?
Figured out what the problems was. I was setting the TVS_CHECKBOXES style in the visual studio resource editor. Apparently this causes the problem I was having with the initial checks. Instead you have to do
m_nodeTree.ModifyStyle (TVS_CHECKBOXES, 0);
m_nodeTree.ModifyStyle (0, TVS_CHECKBOXES);
before filling the tree in OnInitDialog. Once I did this everything worked fine.
I created myTreeCtrl using this code:
myTreeCtrl.Create(WS_CHILD|TVS_HASBUTTONS|TVS_CHECKBOX|, CtrlRect, this, IDC_TREECTRL);
I tried to check some items in OnInitialDialog() and had the same problems.
I tried:
myTreeCtrl.ModifyStyle(TVS_CHECKBOXES, 0);
myTreeCtrl.ModifyStyle(0, TVS_CHECKBOXES);
And now it works fine.
More than that, it didn't check the item if it was not in the visible part of the window. I had to put a trigger on OnVScroll().
Check boxes in tree view controls are quirky. As documented:
If you want to use this style, you must set the TVS_CHECKBOXES style with SetWindowLong after you create the treeview control, and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues.
In other words, you cannot set the TVS_CHECKBOXES tree view style at control creation time. Control styles set in Visual Studio's resource editor (which is just a graphical front-end for the .rc script) are used at control creation time.
The solution is fairly simple: Create the control without the TVS_CHECKBOXES style, and turn it on in code, before you populate the control:
::SetWindowLong( hwndTreeView, GWL_STYLE,
::GetWindowLong( hwndTreeView, GWL_STYLE ) | TVS_CHECKBOXES );
In MFC this can be done using
m_treeView.ModifyStyle( 0x0, TVS_CHECKBOXES );
where m_treeView is the tree view control instance variable.
Background information:
Check boxes weren't part of the initial tree view control implementation. They were added later on, following the scheme developers were using that needed check boxes before they were available: By using a state image list and setting state item indices on the tree view items.
One of the issues that needed to be addressed was determining the check box size. If the tree view control has an image list (the "normal image list") assigned, the check boxes should match the size of those images. Otherwise, the check boxes should use the system small icon size. A corollary of this is that if you are using a "normal image list", you need to enable the TVS_CHECKBOXES style after setting the image list.
Another quirk is, that the state image index 0 means "no state image" at all (1 refers to the "unchecked" state item image). If you add an item to a tree view control that has the TVS_CHECKBOXES style set, the control sets the state item index to 1 (even if you specify 0). That's why all items appear unchecked, when you set the TVS_CHECKBOXES style at creation time. This also implies, that if you want a tree view item without a state image, you have to add the tree view item, and then manually reset the state item index.
This should be enough information, to understand and solve the question as asked. There's a lot more to the tree view implementation, but I'll leave that to someone, that is better equipped to write about it. Refer to the references below.
References:
Raymond Chen (The Old New Thing) has published an extensive series covering the tree view control quirks. Not all of the entries are immediately relevant to this question, but each and every one is insightful and valuable, one way or another, so I'll just list them all:
The TVS_CHECKBOXES style is quirky, which is a polite way of saying that it is crazy
Beware of the leaked image list when using the TVS_CHECKBOXES style
Creating tree view check boxes manually: A simple state image list
Creating tree view check boxes manually: Responding to clicks
Creating tree view check boxes manually: Themed check boxes
Tree view check boxes: A sordid history
Tree view check boxes: The extended check box states