Tool Tip obscures button - wxwidgets

I want to pop up a tool tip when mouse moves over button, to explain what will happen if the user clicks on the button.
This code seems to do the job ( except for a big snag )
wxHelpProvider::Set(new wxSimpleHelpProvider);
...
btnDisplay = new wxButton( this, -1,
"DISPLAY", wxPoint(10,35));
btnDisplay->SetHelpText("Click to display this dimension");
btnDisplay->Bind( wxEVT_ENTER_WINDOW, &cHiddenDimensionPanel::OnDisplayHelp, this );
...
void cHiddenDimensionPanel::OnDisplayHelp(wxMouseEvent& event)
{
wxHelpProvider::Get()->ShowHelp((wxWindowBase*)event.GetEventObject());
}
The snag is that the tooltip obscures the button! If I click on it, the tool tip vanishes for a moment, but immediately pops back up. It is not possible to click the button under the tooltip.

You should be using the SetToolTip(const wxString &tipString) method, and letting wx handle showing/hiding the tooltip - not re-appropriating the HelpText property and manually managing the tooltip display.

Related

issues showing both "return" button and "done" button in "TextInput"

Problem:
Using "TextInput" in react native shows keyboard, and on pressing return, cursor moves to new line, however at this i do not have "done" button to hide the keyboard.
Again, there is props called "returnKeyType={done}, which adds "done" button but now "return" button is gone. I believe user could tap to new line inside "TextInput" box, but it seems to highlight the words typed.
Solution attempt:
Like in numeric keyboard, i thought there should be some props to add "done" button on top of keyboard so that we will have both "return" and "done" botton visible at the same time, but i could not find it.
... another option is i could create my own component with done button, and wrap keyboard as child, but i could not figure out how i do it.
This is basic component, i believe there must be some elegant way to do it. any help is appreciated.
You cannot have done and newline button at the same time.
There should only be one submitting button in keyboard.
But you can make a similar work around.
Custom Button
First option is making custom button like you mentioned.
Make a "Done" button next to your textfield or above the keyboard.
onSubmitEdit
Second option is using onSubmitEdit
Make a custom function that controls what return button should do.
e.g.)
const [textInputValue, setTextInputValue] = useState("");
const returnPressed = () => {
if(need_new_line){
setTextInputValue(textInputValue+"\n");
} else {
returnFunction();
}
};
return (
<TextInput
value={textInputValue}
onChangeText={(text)=> setTextInputValue(text)}
onSubmitEditing={()=> returnPressed()}
/>
);

UWP XAML Windows Phone Dialog issue with soft Keyboard

I've developed an app, as soon as the user enters a username and password and continues I display a dialog with a selection of buttons for the user to choose. As there is a login screen, the keyboard is displayed. I've hooked into the Enter button so that it is the same as tapping the Sign In button - this is where I hit issues.
IF the dialog is shown whilst the keyboard is active, the dialog content size is not full screen (despite the keyboard disappearing). But if the Sign In button is tapped (i.e. keyboard is not active) everything is fine.
The images below probably explain things better.
I'm not sure what to do to resolve this - any ideas?
FYI - I can scroll the buttons but only in that top section of screen.
As always - I ask a question and then find the answer.
When I catch the "Enter button tapped" event, I set focus to the page. It's a bit of a hack as I'd rather know why the issue is happening and stop it altogether instead of just dealing with it, but it works...
this.Focus(FocusState.Keyboard);// this is the line that solves it.
Full code:
private void tbPassword_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter)
{
this.Focus(FocusState.Keyboard);
StartLogin();
}
}
#Rick have a good way.But I have other good way that you can make the keyboard show and UWP can arrange the UI.
You can use InputPane.GetForCurrentView().TryHide() to hide the keyBoard and use InputPane.GetForCurrentView().TryShow() to show the keyBoard. So you can hide it when you want to show the ContentDialog.
But I have not think it is a good way.
You can use InputPane.GetForCurrentView().Showing to know when is the keyBoard is Showed and use InputPane.GetForCurrentView().Hiding to know when hide the keyBoard .
First,you can make the Grid with a row is show keyBoard when show keyBoard it will get the Hight.
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition x:Name="HightKeyboard" Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
When the keyBoard be showed ,you can use e.OccludedRect.Height get the keyBoard's height.
InputPane.GetForCurrentView().Showing += (s, e) =>
{
HightKeyboard.Height=new GridLength(e.OccludedRect.Height);
};
And you should make the row height hide when hide the keyBoard.
InputPane.GetForCurrentView().Hiding += (s, e) =>
{
HightKeyboard.Height=new GridLength(1);
};
You can show the UI in the first Row ,and when the keyBoard show the height above will be arrange.

Selecting popup without title and clicking button inside it with geb

I have a popup without title and I want to detect the window using any other criteria (for example a div that wraps the whole popup) and click a button inside it.
I've tried the following:
when:
withWindow({ $("div", class:"main.msgAlert" )}) {
$('#close').click()
}
then: true
But I always get a org.openqa.selenium.ElementNotVisibleException at te #close action.
Am I failing at detecting the window or is the error related to the button?

Getting the name of a button while the progress bar is going on in webdriver

I have one button named "Add" in my web portal. On clicking on that button a progress bar appears and the name of the button gets changed to "Adding" from "Add" and remains "Adding" until the progress bar is not moved to 100%. After the progress bar is 100% complete, again the text of Add button changes back to "Add" from "Adding".
I need to assert whether the name of the button is changing from "Add" to "Adding" or not during the progress bar movement. But the problem is once I click on the "Add" button, then use the assertion, selenium will first click on "Add" button, completes the progress bar to 100% and then tries to assertion, but now already the text of "Add" button is already changed back to "Add" from "Adding".
Please give the solution. Thanks in advance.
You can find the element, click and immediately return it's text which can be used later for Assert
public string Test()
{
IWebElement element = Driver.FindElement(By.CssSelector("Something"));
element.Click();
return element.Text;
}
Assert.IsTrue(Test().Contains("Adding"));
Note: C# code

Custom context menu XAML for WP8

I try to implement a custom ContextMenu in a LongListSelector.
I'm not using the ContextMenu from Microsoft.Phone.Controls.Toolkit, it's basically the same as in the Rowi App:
(source: hiddenpineapple.com)
Approach 1
My list item toggles a VisualState on hold and an overlay is shown with controls in it.
The problem
I can't find a way to go back to the default state when the user clicks outside of the list item (as in the default ContextMenu).
Approach 2
I've implemented a custom template for the toolkit ContextMenu which looks exactly the same. I had to move its margin top to -itemHeight, as by default it is below the item.
The problem
The problem with this solution is, that it automatically closes itself when opening and I couldn't figure out how to avoid this.
Another problem was that it didn't work well with TiltEffect.IsTiltEnabled from the Toolkit (visual problems).
I need your help
Any suggestions on how to get this working?
Answer
Thanks to Cheese, now I know how to properly close the menu when the user clicks outside.
His suggestion was to get the coordinates of a Tap event on the current page, and check if it's inside the menu. When not, close the menu.
So I added a Tap listener to the page when the menu opens, and removed it when the menu closes. From the page listener I got the event coordinates and could check if it's inside the control which holds the menu (same size and position). I received the position of the control with Point leftUpperPoint = control.TransformToVisual(page).Transform(new Point(0, 0)) and the rightLowerPoint by adding the ActualWidth and ActualHeight.
But then I realized:
Why should I even calculate if the tap is inside the menu? I always want to close the menu when the user taps anywhere on the screen. If it's outside, yes. If it's on a menu button, yes.
Another modification I made was to listen for MouseLeftButtonDown instead of Tap as it also triggers when the user swipes.
So I removed this code and came up with the following:
private void ToggleMenu(object sender, System.Windows.Input.GestureEventArgs e)
{
PhoneApplicationFrame frame = ((PhoneApplicationFrame)Application.Current.RootVisual);
VisualState state = this.States.CurrentState;
if (state == null || state.Name == "DefaultState")
{
frame.MouseLeftButtonDown += MouseDownDelegate;
this.State = "MenuState";
}
else
{
frame.MouseLeftButtonDown -= MouseDownDelegate;
this.State = "DefaultState";
}
}
private void MouseDownDelegate(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ToggleMenu(sender, null);
}
This works perfectly!
Thanks to Cheese for the hint.
Something like this by #denniscode http://dotnet.dzone.com/articles/rowi-show-tap-menu
Approach 1 problem
The best solution would be:
Get the menus coordinates, when user makes a tap - you check are tap coordinates on menu or not, if not - dissmiss - simple.
Approach 2 problem
I guess you had some button in a corner and when you tapped on it - nothing happened? And when you dissmissed the Tilt all worked. It seems that tilt works faster than a click, so, tilt changes the button coordinates, and device thiks you have missed/or dragged off
You can use what #ScottIsAFool suggested and maybe create another Dependency Property on your TapMenu control of type UIElement named CloseWhenTappedElement and automatically listen for Tap events inside your control once set. For example
<Grid x:Name="TapArea"/>
<TapMenu CloseWhenTappedElement="{Binding ElementName=TapArea"}/>