Is it possible to change the button name when you click it?
I'm currently doing a imgui project. I want to change the Global view and the Local view in one button using ImGui::Button. Is that possible in the current ImGui version right now?
Just change the label of the button depending on your current state..
And you can use the ### operator (described in FAQ) to keep a stable ID.
if (ImGui::Button(view_is_local ? "Local###ViewMode" : "Global###ViewMode"))
view_is_local = !view_is_local;
Related
When dealing with login screens, I am trying to work out the better approach - either execute navigation "action" to go to login fragment on first use (and hide back button to actual app), or start a new login activity (with its own nav graph). For the first approach (just using navigation components), I do not know the way to remove the back button without a hack "hide". I tried using navoptions, setpopupto etc., but it does not work. Code below:
val navOptions = NavOptions.Builder()
.setPopUpTo(R.id.home_fragment, true)
.build()
host?.navController?.navigate(R.id.action_global_signUpFragment_dest, null, navOptions)
Two questions then:
1) How to properly handle login transition with just navigation component?
2) Is starting a new login activity, with separate nav graph, a better idea?
I think the first approach is better.
To hide the 'back' button on your toolbar inside signUpFragment you can use AppBarConfiguration, and customize which destinations are considered top-level destinations.
For example:
val appBarConfiguration = AppBarConfiguration.Builder(setOf(R.id.home_fragment, R.id.signUpFragment_dest)).build()
NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration)
This way home_fragment and signUpFragment_dest will be considered top-level destinations, and won't have back button on toolbar.
Another option for solving the back button problem is how I did it here. Also, rather than show/hide the bottom nav bar, I have two NavHostFragment, one main full screen one, and one contained within the home fragment (above the bottom nav bar).
When I want to navigate to a full screen view I call this extension function,
fun Fragment.findMainNavController(): NavController =
Navigation.findNavController(activity!!, R.id.nav_host_fragment)
then navigate via the main graph.
This makes sense conceptually to me, to have parent and child nav graphs.
Actually i'm developing a Apple Tv project in swift3.I faced some problem with focus navigation using remote.
Is there any way to change focus from one object to another object which i want.
I tried below code but not working......
override var preferredFocusedView: UIView? {
get {
return preferredFocusedView1
}
}
In the bellow screenshot i want to move focus from the pink icon to the star button when pressed down button of remote. how it is possible. plz provide me some code in details
I have a set of normal CButtons in MFC when a user clickes on one button its appearence should be changed to reflex the idea that it has been clicked sth like in the picture
i tried to change the style of the clicked button using the following code
button->SetButtonStyle(BS_DEFPUSHBUTTON);
Invalidate();
but the problem with this approach is that just one button at time is allowed to be marked so any ideas ? is the only way is to use a bitmap ?
Use CButton::SetState
This page has an example of what you want to do:
http://msdn.microsoft.com/en-us/library/ebw1hfe8(v=vs.90).aspx
I'm building a small program in Qt with menu bars (menuBar) using C++ and I would like to know how to gray out (eg. disable) an item of the menu when a certain variable is activated. Is it possible?
If you know an index of the corresponding QAction :
QMenu::actions.at(i).setEnabled(false);
P.S. As kindly prompted below, setEnabled(bool) and setDisabled(bool) are slots (so is toggle()), so they can be connected to a signal indicating a need to change the availability of the action.
Looking for the index of the action is not necessarily convenient. If you have built the interface with QtCreator's form editor then you will have an action for each menu item. Their names are based on the text that you first give to the actions. For example if you interactively enter a menu item with title Foo Bar then an action named actionFoo_Bar is created for you. Just type ui->action in the code editor and watch what "name completion" QtCreator will propose.
In such a case I would consider a call like this:
ui->actionFoo_Bar.setEnabled(false);
You can even make the menu item disappear with
ui->actionFoo_Bar.setVisible(false);
I have a C++ MFC MDI application. I have a tool bar with some buttons on it. I need to add some check boxes to this toolbar and i need them to have custom bitmaps just as my buttons do. Thanks
EDIT:
By bitmpas i refer to the pixel images that can be created using the tool bar editor in visual stuidos 2008. I would like a picture (of my creation) instead of the usual tick box.
You don't use checkboxes on toolbars.
You should rather use regular buttons in Check mode. That means that the button stays pressed when user releases it. Clicking it a second time releases the button. This is the same behaviour as a checkbox.
You can either set a toolbar button as checkable by code:
m_ToolBar.SetButtonStyle(nButtonId, TBBS_CHECKBOX);
Or by enabling the corresponding property in the resource editor.
If you want to modify the image displayed when the button is pressed, in your ON_UPDATE_COMMAND_UI handler, use m_ToolBar.GetButtonInfo() to check if the image matches the state. If not, change it using m_ToolBar.SetButtonInfo() and specify the index of an extra image added to the image list of the toolbar.
The following is a link which might help you
http://www.ucancode.net/Visual_C_Control/Place-Combo-Edit-Box-Progress-Control-On-ToolBar-CToolBar-VC-Example.htm