Showing wait cursor in windows application for log running task - cursor

I am showing wait cursor with image (System.Drawing.Bitmap) in a windows form and it is not flashing when i click on button and start flashing after event is executed.
As per my understanding wait cursor form did not get focus when event fired and start flashing after event executed
I want to perform this task when user clicks on button event and stop when code end.
I am using vb.net with framework 4.0
Thanks

Cursor.start()
//ur code
Cursor.stop() !!
simple is that what you wanted??:S if yes mark as answer

Related

monitoring the click event on the maximizing button on the control box

I am creating an windows form application and I want to know how to check when the maximize button is clicked.
Can someone please help me?
The re-size even handler is not detecting when the form is maximized or normal.
And I don't see any event handler for the maximize button on the control box.
Or is there any script in windows form that constantly run over and over.
You need to hook up into ClientSizeChanged event. In this event you can monitor WindowState.
To show a messagebox when window is maximized, add following code into forms ClientSizeChanged event:
If(WindowState == FormWindowState.Maximized)
{
MessageBox.Show("Maximized")
}

When Modal Dialog is shown in WPF and a user clicks on the parent window, make the modal dialog flash, blink or shake

New Thought, Maybe I am looking at this totally incorrectly. So Here is exactly what I am trying to do in case there is another option I am not aware of.
I have a WPF app, the main window shows a smaller dialog window using ShowDialog(), when a user clicks on the parent window that showed the dialog, I need to make the dialog window, flash, shake or blink.
AresAvatar posted a link that looks like it might be able to use, but is there another option I am not aware of?
My original Question.
Mouse click event when Modal window's parent is clicked in WPF app?
I have a wpf app that shows a modal window using ShowDialog().
I would like to fire an event when the user tries to click the parent window that is now disabled.
Is it possible on the parent to receive a click event when it has shown a modal window?
When I attempted this using an interaction trigger, the events never fired on parent window.
Otherwise, what suggestions / options are there.
Thanks
No WPF events are sent under these conditions. The only Windows message I can see that gets sent is WM_WINDOWPOSCHANGING. You could check for that message, and check if the window was disabled when it occurred. Here's a good article on checking WM_WINDOWPOSCHANGING.
Edit: that link seems to be dead. Here's an example on StackOverflow of checking window messages.
I know this is an old question but I'll post my solution in case any one needs it.
Set the dialog.owner prior to calling ShowDialog().
var dialog = new DialogWindow();
dialog.owner = MainWindow;
dialog.ShowDialog();
The result is that clicking on the main window, brings the dialog window to the front and makes the dialog window flash.

gtk_message_dialog in a GtkCombo callback

I'm developing an app in C using Gtk. I have a GtkCombo with some restrictions that should launch an error message when user selects wrong entries in the list. The problem is that when callback launches the error message, pop-down string is still open, and if the user moves the mouse over it, the list acts as if all entries under the mouse pointer where clicked. This behavior stops if the user clicks on an empty window area or other GtkWidget. I've tried changing the focus to another widget, launching button_release signal...
Anyone knows how to prevent this bug?
Try connecting the signal with g_signal_connect_after() instead of g_signal_connect(). The callback should run after the combo popdown has finished all its reactions to the click.

Silverlight click event registered a second time before first event completed

I have a button which launches a "modal dialog" - it just creates a transparent grid covering everything, with the "dialog" created on top of that.
However I have a strange issue - if I double/triple click the button really fast (or add some delay in the event code), the button click event is executed multiple times, creating multiple overlapping modal dialogs. If the first action in my event is to disable the button (IsEnabled=false) it seems to prevent this.
My guess is that Silverlight is being multithreaded with input - it is not only recording the second click in another thread (while the button's click event is running), but it is jumping the gun by evaluating which control should be the target before the previous event has finished executing. Even though that event alters what control is at those mouse coordinates, it doesn't matter.
Does anyone know anything about this behavoir, or a way around it? If I have something like a save window, where the user clicks a save button, a blocking grid ("Saving...") is placed up while it saves, and then the whole "window" is closed, I'd like to avoid the user being able to queue up multiple save event clicks (this could lead to unpredictable program behavoir).
If you've ever worked with WinForms or WPF, this is expected behavior. Your button is broadcasting its Click event until your modal dialog covers it up. Unfortunately, there is some amount of time between your first click and when the modal dialog covers the button which allows multiple clicks to the original button.
You have two solution choices:
Disable the button after the first click and then re-enable after the modal dialog returns. You've already mentioned that this works.
Write code in the Event Handler of the button to determine if a modal dialog is already being displayed. This way, you're putting the responsibility in one location rather than splitting it up (disabling and re-enabling the button). This would be my preferred solution.
I think what you're seeing is the behaviour of Silverlight's routed events.
You can set the Handled property of the event arguments to true to prevent the event from bubbling.

Making the window [X] button close instead of minimise on Windows Moblie

The [x] button in the top bar of a window that normally closes the window in standard Windows, appears to do a minimise instead on Windows Compact.
How do it make it close instead? I need to also be able to raise an event when this happens as I want to preform some logic on window close.
Set the Form.MinimizeBox property to false. This will change the [X] to [ok], and close your form instead of minimizing it when clicked.
Edit: The event you want is either Closing or Closed.
I'm not sure how this relates to the .NET forum support but you need to use the Native API SHDoneButton.
By default it's set to "SHDB_HIDE" which then shows the "Windows Mobile" "X" button (or any application that overrides X button like LGE's 'X' button application, or the HTC one).
If you set it to "SHDB_SHOW" it will show a "ok" button which sends a IDOK to the window if pressed.
If you set it to "SHDB_SHOWCANCEL" it will show a "x" button which sends a IDCANCEL to the window if pressed. SHDB_SHOWCANCEL is not documented by MSDN but it's in the header file (aygshell.h).

Resources