I have action pane's MyButtonGroup's visible property set to 'no'.
What I want to do is to show (to set its visible property to 'yes') MyButtonGroup when I click Line view button.
I overrode Line view's method gotFocus:
MyButtonGroup.visible(true);
super();
but I also want MyButtonGroup visible property to be false if Line view button is not focused / clicked
for this I overrode the lostFocus method on Line view
MyButtonGroup.visible(false);
super();
so the lostFocus method "does not work", I mean when Line view button is not focused anymore
MyButtonGroup remains visible.
how can I solve it?
Never use gotFocus or lostFocus.
Use the clicked method of LineViewButton and HeaderViewButton instead.
See my pastebin for an example.
That said, you are on the wrong track, the button group would be better placed on the action pane directly above the lines.
Related
I have a certain set of buttons registered so that they can be executed using letters in a keyboard or by mouse click. But I want to hide the text in the button from the user so that it looks more natural.
Heres part of the code:
ToggleButton btn1 = new ToggleButton("");
btn1.setMnemonicParsing(true); // instruction to parse mnemonic
btn1.setText("_7");
Now instead of the button showing a 7 in the middle I want it to be hidden but still function the same. I have a feeling it has something to do with the setVisible() method but I'm not sure how to use it for just the text inside the button instead of the entire button itself.
Most probably you can't do both at the same time. If you want to trigger the button using MneomonicParsing, then you have set the text and it will be visible in the button.
Why don't you use a onKeyPressed method of the container of those buttons instead? Then you don't have to set any text on the button. Like this:
container.setOnKeyPressed(k->{
switch(k.getCode()){
case NUMPAD7:
case DIGIT7: btn1.fire();
break;
//implement other cases
}
});
I have a dialog based application. I have one static text control and a button on this, both of which I have made invisible in the beginning. I want to show both the controls on reaching a certain condition. When I click this button, again I want to make both the controls invisible.
However, I am able to show and hide the control and also captured the button click event like this:
ON_BN_CLICKED(IDC_MY_BUTTON, &MyDlg::OnBnClickedMyButton)
and defined OnBnClickedMyButton().
But when I press the button, it is not pressed and the event is also not generated.
Any suggestions?
First check if the IDC_MY_BUTTON exists and is valid.
Remember to add DECLARE_MESSAGE_MAP() at the header file.
Also check at the BEGIN_MESSAGE_MAP(MyClass,MyParentClass) if the class
and the parent class you write are right.
I hope this helps.
I think the IDC_MY_BUTTON maybe is invalid or other control has the same ID.
Well, finally I have come to know that though the button was visible but on clicking it was not taking control, hence I used BringWindowToTop() to draw it on top. Now it is being clicked and OnBnClickedMyButton() is also being called.
But now the issue is that after calling BringWindowToTop() the button is not shown. It is shown only when I take the mouse pointer on it. Not able to understand what is the issue.
I have the navigationcontroller based viewcontroller and I overriding the root view controller navigation bar back button in to my custom segment control with different purpose. This navigation controller is placed one of the separate tab in the uitabbarcontroller. If this is used as the separate tab bar then no problem.
But if i use this navigationcontroller inside the more option in tabbarcontroller i am not able to come back to the more option list because of backbutton is overridden in my navigationcontroller.
My idea is add one back button only if my navigationcontroller is used more option tab otherwise i need to hidden the back button.
Please help me in this issue?
You can check if a view controller is in the 'more' section as follows:
BOOL isOnMoreNavigationController = [tabBarController.moreNavigationController.viewControllers containsObject:myViewController.navigationController];
From a UI consistency perspective it might be better to always show the back button in its standard position and move your custom buttons to some other place.
I have placed a few buttons in a Qgraphicsscene, but I don’t know how to navigate to the button from a keyboard.
How would I set the focus to a button from the keyboard?
I assume that you used QGraphicsScene::addWidget() to add the button to the scene? It gives you a proxy object back, QGraphicsProxyWidget *, which inherits QGraphicsItem::setFocus(). But remember that it needs to have set the ItemIsFocusable flag and needs to be visible and active as well.
Additionally (from the setFocus() documentation):
As a result of calling this function, this item will receive a focus in event with focusReason. If another item already has focus, that item will first receive a focus out event indicating that it has lost input focus.
I am using a box element to add a transparent overlay to a column of buttons. I want to add a click event to the buttons. However, when you click a button the click event is only triggered on the overlaying box. Is there anyway to pass the event to the underlying button or perhaps a better way to display an overlay without blocking the click event?
If you want a DisplayObject (which nearly all visual things subclass in Flex) to be treated as "transparent" to the mouse (i.e. it won't intercept click events), set that object's mouseEnabled property to false.
e.g.
transparentBox.mouseEnabled = false;