wxWidgets - Switch between different view on button click - c++

I am making a music application, I have it show like a mini-view of the app as the default view, and I want it to switch to a big view on a button click. The default/mini view has a panel -> sizer -> sub-sizer -> widgets. And for the big view, I have a separate sizer and panel.
The default view looks like this
And when I press the L button on bottom right, I want it to switch to big view which is supposed to look like this
The top panel is empty here, I have not added widgets to it yet. I can provide additional information if required, like code snippets and all. But I want everything to be on the same wxFrame. I have defined all widgets in the constructor, but it overrides the previous panel and sizer. Also I want to be able to switch back and forth between the 2 layouts.

For completely replacing the frame contents like this you may find wxSimplebook useful as you can then just call its ChangeSelection() method to switch pages. You will need to adjust the frame size, e.g. by calling frame->SetClientSize(book->GetBestSize()), after switching pages manually however.

Related

How does a CSplitterWnd and two different views handle UPDATE_COMMAND_UI for the menu/toolbar

I took an existing single view and changed it to a CSplitterWnd to add a new split view of a new CTreeView and the old CListView.
How is the toolbar update supposed to work with the use of UPDATE_COMMAND_UI so when THE focus is in one view vs. the other, the toolbar options are enabled/disabled properly (some toolbar buttons are shared).
Turns out MFC tries the active view first, then moves up to the mainframe and even document and app. So you can handle the UPDATE_COMMAND_UI wherever it would make the most since.

Resetting Programmatically adding buttons for UITableViewCell Reuse

In my tableview controller. The images are being added as backgrounds to the button. These buttons are then added to the table view cell on user requirement.
If i show/hide the cell. The buttons with background images from the hidden cell are being shown on the enabled row/cell i.e. overlapping. I have read articles regarding prepareforReuse function. Which can be used if i know the existing properties. In my app the buttons are being added based on user selection.
Is there any way to use prepareforReuse to reset every thing even the buttons which have been added programmatically so that when they are called then overlapping issue doesnt appear.
Main Problem: I cannot give names of my buttons to set their values as nil because i dont know how many will be created. While in prepareforReuse (to reset the cell) i need to provide some property names which exist in cells already.

How to expose standard back button in view controller navigation?

I need users to be able to navigate a data hierarchy (master level, detail level) and to create new master and detail objects accordingly. Both master and detail use arrays for their model and TableViews for presentation
The navigation flow for this uses 2 navigation and table controllers like below. The + of the master and detail TableViews create new objects, the forstTableCell navigates to the second TableView using a segue:
While the screenshot shows "Done" right now even when removing that ButtonItem the slot remains empty.
I would like to show the standard back button instead: "< Middlewares" in this case. In the tests I've only been able to get the back button when navigating to a normal ViewController, but not to another NavigationController. Is it possible to have it between Navigation Controllers, too?
Simply remove the second navigation controller. If you use a push segue, your second view controller will still have the navigation bar. As long as you don't use a modal segue all view controllers that are pushed will have a navigation bar.
So your storyboard will look like this:
You will then automatically have a back button. If you want to change the text of it, go to your navigation item of your first view controller and change the back title accordingly as shown in this screenshot
You certainly want to have a title in your second view controller (something like "Add [whatever you want to add]". So simply drag & drop a UINavigationItem on your second view controller then you can also add UIBarButton items in your Interface builder
Controlling the look/feel of the Navigation Bar Buttons
You can achieve the behavior you want by opening the Document Outline and find the existing Done button. If you have a UIBarButtonItem type, you can simply change the type to Custom in the Inspector. Next add a regular button within the UIBarButtonItem (just bring the Navigation bar for the target controller into the zoomed in view of the storyboard/xib). This will allow you to drag a button onto the navigation bar.
Once you have a standard button you can add an image with the back arrow. Then add supporting code to use the pop behavior on the Navigation bar. Since you can have only one root navigation controller, you may want to remove the second UINavigationController and add a UINavigationItem from the objects library and then subsequently add the buttons, titles of your choice. This configuration will allow you to leverage all of the push and pop methods available, while retaining full control of the look/feel/behavior of the navigation stack.
More on customizing the look/feel/behavior of the UINavigation Stack can be found at: Navigation API Docs

How can I add a button in a footnote in Google Glass?

I'm trying to implement a footnote along with couple of buttons inside the footer.
Card card1.setFootnote("Footer");
Button btnSave = new Button(this)
Button btnClear = new Button(this)
card1.setButton(btnSave); //no option to put into card at footer
card1.setButton(btnClear); //no option to put into card at footer
How could I do this?
While you could modify the view hierarchy that gets returned by Card.toView() to insert whatever widgets you want, consider that this isn't the best approach for user interaction. Since Glass does not provide a touch screen, Button widgets make little sense on that form factor.
A better approach would be to add an options menu with your actions that would be presented when the user taps on the touchpad.
If you really want to do that Rakesk then i suggest you design your layout in landscape using xml. Size of that layout should be relative to 640 x 480 resolution. In this way you can add as many widgets in the UI as you want though it is not recommended.

Sencha Touch : Open View on List Click

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.