I have a textual NSDatePicker with no stepper (only shows hours and minutes) and want the user to enter these by hand. Everything works as expected, but only if the user types very fast. It looks like after around 1 second the NSDatePicker runs some internal method _userEditExpired: and takes what has been entere`d so far and selects the subfield. Means if I want to put in 45 minutes and wait too long after the digit 4 it will just take 4 minutes.
Any ideas how to disable or at least lengthen that timeout?
Related
In by vb.net form, I have some 300 lines of code that performs various operations.
Approximately it takes 40 to 60 seconds to complete based on given inputs. End users asked me, We don't know whether the process is undergone or hanged-up.
So, I need to display a progress bar which should gradually increase according to the execution of code.
During the execution of 75th line, the progress should display loaded upto 25%.
During the execution of 225th line, the progress should display loaded upto 75%.
So, How to achieve that.. Can we achieve that by using Thread ? If yes, how can I ?? I am new for Thread.
So I am doing a reminder tool in Visual Basic for myself and I added a MonthCalendar to the windows (check image). It runs great. User writes down the name and a date (in 24 hour format for now) and then when you click the add reminder, it registers it into the listbox and also writes it into a file so when user closes and opens the application, it stays there. When the time in my PC coincides with the one in the program, a message pops up. The only thing left I'm having trouble is with dates.
I want to be able to choose a date and a message popping at that day with the time. I know it might be simple, but for some reason I can't think of a way and searching around didn't help me.
Here's a snippet of the code I have for when the time coincides:
If (TimeValue(Now) = time) Then 'Dim time As String = l.Substring(0, 9)
MsgBox(msg)
End If
I thought using an If statement similar to this would work, but it tells me that dates really don't go well with boolean and I tried looking around the subfunctions, but I've yet to find any.
To be clear: The only thing I need is to be able to register the date. Here's an image of the designer view.
Design View
Use a Timer. Calculate how many milliseconds there are until the event and set the Interval of the Timer to that value. The maximum Interval value gives you just over 24 days. If you need more than that then simply set the Interval again when the Tick occurs. You keep going in jumps of ~24 days until you get to the event.
I have several froms in my application. When application starts, a timer starts for 30 minutes.
I want to show the remaining time using a popup window, message or whatever, on whichever form the user is at that time.
Please advise how to do it.
Thanks
Furqan
The timer objects in the .net framework do not give access to the time already elapsed or remaining.
However when your application starts you will can create and start a stop watch.
private _sw as System.Diagnostics.Stopwatch = System.Diagnostics.Stopwatch.StartNew()
At any time you can then call the following code which you can subtract from your 30 minutes
_sw.Elapsed.TotalSeconds
To show this time constantly on a form you may need a second timer to update the screen that queries this value.
I have a Windows vb.net project that does an occasional "auto refresh" based on a 20 minute timer. I want to avoid any type of auto-refresh... if the user has manually had any interaction with the program (mouse move, click, keystroke, anything) in the past 5 minutes.
I added a global variable "Dim g_LastActivity As Date" so the timer can detect that 5 minute mark.
Is there some place to put my "g_LastActivity = NOW" line that will ensure it will happen during ANY user activity? All mouse clicks, on all buttons, all mouse moves, anywhere, all keystrokes, basically EVERYTHING.
Or is there an entirely different way to do that?
Look into Application.Idle event to see if it will fit your needs.
Basically in my website I have a sidebar with a stack of boxes; each box can be collapsed or expanded by the user. I need to save the status of each box for the currently logged in user.
I don't want to use cookies because if an user changes browser or computer, all the boxes will go to the default status.
Should I save this information on the database making a query every time the user collapses/expands a box? How would you handle this? Thanks.
Edit: What if an user clicks on the toggle button repeatedly, like ten times in two seconds, just because he enjoys the boxes' animation? He will make ten queries in two seconds. So maybe the question should be: when should I save this data?
Call a (client-side) "changed" function every time a box changes.
Keep two items of (client-side) state: the time the last update to the server was sent and whether a timer has been set.
Write a (client-side) "update" function that sends the update and updates the state to mark that the last update was just now.
When the changed function is called: if a timer is set, then return immediately; if an update has never been sent or the last update was sent more than ten seconds ago, then call the update function and return. Otherwise set a timer to send the update after ten seconds.
The timer callback should simply clear the timer flag and call the update function.
Also on an unload event check if a timer was set and if it was then clear the timer and call the timer callback function.
So the result is that you send the update immediately except when the user is flapping, in which case you only send an update every ten seconds at most.
There might be some cases where you lose an update, but this is likely to only happen if the user was playing with the toggling and then closed the page before the timer fired, in which case he probably won't notice anyway.
If you need to persist these options from multiple computers you will need some form of server side storage.
This could be database or flat file. The choice depends on what you have available, skill set, and the need to scale. If you are going to have just a few users, a flat file may be your best choice.