Start and End DateTimePickerCtrl in WinApi/WTL - winapi

I have two DateTimePicker Controls in Win Api/WTL/ATL, the first represents a start date and the second one represents the end date, how can I restrict the date selected on the second one to be 'later' than the one selected in the first one?

Controls send "standard" DTN_DATETIMECHANGE notifications on value changes. So you need to handle those from both controls and adjust values appropriately, e.g. updating the value of the other control so that "start < stop" at all times.

Related

NSDatePicker commits subfield changes on a timer

I'm using a plain NSDatePicker control with NSYearMonthDayDatePickerElementFlag. It's the same as the date picker on the "date & time settings" panel with MM/DD/YYYY fields (the text box with 3 subfields, not the calendar portion). My users are getting stuck typing the digits into the year sub-field (though the behavior is present on the month and day fields too).
You can reproduce the problem using the Date & Time settings panel. Uncheck "Set date & time automatically" and click on the current year part of the field, 2014. Now just type 19 and pause. After about 1 second it fires some event and changes the date to 1969.
My users don't seem to type as fast as the NSDatePicker expects them to. Some event fires, calling some internal function NSDatePickerCell(NSTextFieldWithStepperDatePickerInternal)_userEditExpired:, well before many of my users can finish entering the 4 digit year. The timeout is reset after each keystroke, and seems about a second or a little less.
Does anybody know of a way to defeat that behavior without resorting to writing a whole new date picker? I'd be happy with a way to just change the timeout to something longer, maybe about 5 seconds, so the slower typists can get all 4 digits entered without the event firing and accepting their input before they're finished.

How to get constant feedback from a slider in Xcode with ApplescriptObjC?

I'm new to ApplescriptObjC as you'll probably see if you keep reading. I was wondering how to get constant feedback from a slider so that as soon as its value is 1 it runs script A and as soon as its value is changed to 0, it runs script B.
I know you can have actions for buttons like:
on buttonClicked_(sender)
do action
end buttonClicked_
But how can I have a one that constantly checks for a change in the slider's value and does the appropriate action? Is it similar to connecting a slider to a text box with the getStringValueFrom() thing?
Any help would be appreciated. Thanks :)
Found out how!
turns out on action_(sender) will work for sliders as well. They send the signal every time the item is clicked on and released whether a change exists or not. Then its a simple matter of an if statement to run two different series of actions depending on the value the slider was set to.

How to bind ListBox to a very large data set

I want to display a very large number of items to my ListBox. So I use binding like this
listBox.ItemsSource = largeList;
My ListBox does use VirtualizingStackPanel, however, I see that it takes very long time to render on the screen.
Is there a more effective way to do this ?
I am not sure if there are realy big data you should display them to user
By the way you could trick it like this :
Make a new timer , on tick event (every 5ms) add less than 5 items

Xcode calculations with multi-component picker

I would like to set up a view controller with a 2-component picker where each side contains the same 7 objects. Each object carries the same value for both components. The user would make a selection from each side, enter a value in a provided text field (and optionally tap a "Calculate" button). A calculation would occur using that value and the values from the two picker component objects that were selected and the results would be displayed in a label.
For example, each picker contains the letters a - g. Each letter carries the value of 1 - 7 respectively, for each side of the picker. The user selects "b" and "d" and enters 10. The calculated result of 10 * 2 / 4 = 5 is displayed.
It sounds simple enough. I've found tutorials for doing calculations using values associated with a 1-component picker as well as working with 2-component pickers, but nothing for doing calculations with 2-component pickers. My experience with Xcode is somewhat short. So, feel free to go into detail.

Choosing the order that text fields cycle when tab is pressed

I have several text fields and would like to set a particular order in which they would cycle when the tab key is pressed. Currently, it starts at a text field with becomeFirstResponder and then goes on in the default order which xcode put. Can I somehow bypass that order and force the text fields to cycle in a particular order? Like linking the last one of the cycle back to the first one.
Thanks for the help.
Connect the initialFirstResponder outlet of your window to the first text field, then build a chain by connecting the nextKeyView outlet of that text field to the text field that should come next (and so on).
That's called the key view loop.

Resources