Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date Dialog
#1
Gintaras,

An application that I am trying to drive with QM uses date dialogs very similar to the first one you demonstrated in your reply on April 21 to Lucas in "Date Dialog", the one with the popup calendar. This popup is nearly identical to yours, but slightly different colors, font and left/right arrows.

Another difference is that in the associated text bar containing the selected date, this application does not allow me to type my desired date, and I am forced to use the calendar to select my date.

That's not that bad interactively, but it's quite a pain to do it programmatically, calculating how many times to left click which arrow, and calculating the pixels corresponding to the appropriate date for the selected month/year.

I don't think I'll have any real problems doing that if needed, but I was just wondering if this was a "standard" widget that could be somehow interfaced to in order to drive it via text, ie, to just feed it the desired date rather than going thru the mouse moves.

Don't know if it means anything, but QM sees the popup as msvb_lib_monthview.

Thanks.
#2
Example of setting current date of standard month calendar control (SysMonthCal32). If your control is derived from SysMonthCal32, should work too, you only need to replace class name. The month calendar control must be visible (probably).

Code:
Copy      Help
def MCM_FIRST 0x1000
def MCM_SETCURSEL (MCM_FIRST + 2)

DATE d="5/5/2005"
SYSTEMTIME st
d.tosystemtime(st)

int mc=win("" "SysMonthCal32") ;;change this to "msvb_lib_monthview"
SendMessage mc MCM_SETCURSEL 0 &st
#3
Thanks for the tip, Gintaras. Unfortunately, it didn't work. I loaded the macro via Edit/Other Formats/Paste Escaped, changed the class name as you suggested, opened the application and the date-picker control, and ran the macro. The application crashes and a MicroSoft Error Report is generated.

Anything else that might be worth trying?
#4
Good news, because it really should crash the app, because I forgot that pointer to SYSTEMTIME structure must be in address space of that app, not QM. Try this:

Code:
Copy      Help
def MCM_FIRST 0x1000
def MCM_SETCURSEL (MCM_FIRST + 2)

DATE d="5/5/2005"
d.tosystemtime(+share)

int mc=win("" "SysMonthCal32") ;;change this to "msvb_lib_monthview"
SendMessage mc MCM_SETCURSEL 0 share(mc)

share returns pointer to 1 kB of shared memory. If used without window handle, the pointer is in address space of QM, and QM can write to the shared memory using this pointer. If used with window handle, the pointer is in address space of that app, and can be passed to that app with SendMessage.
#5
That is a beautiful thing ... it worked like a charm!

Thanks! Big Grin
#6
Oops, I spoke too soon earlier.

When I actually tried to use the method you described, I found that it changes the date reflected by the calendar, but doesn't update the date field itself. If I re-select the down arrow on the date text line to close the calendar, the calendar closes, but the text date does not update.

Is there some other call we have to make?
#7
key LR
#8
Sorry Gintaras, I must be missing something. My macro now looks like this:

def MCM_FIRST 0x1000
def MCM_SETCURSEL (MCM_FIRST + 2)

DATE d="5/5/2005"
d.tosystemtime(+share)

int mc=win("" "msvb_lib_monthview")
SendMessage mc MCM_SETCURSEL 0 share(mc)
key LR

I open the date-picker control by clicking the down arrow right of the date field. The calendar pops up representing today's date, same as the text. I run the macro and the date on the calendar changes accordingly, but the text date remains today's date. So I close the calendar by clicking the right arrow once again, and the calendar goes away leaving today's date still in the text field.
#9
Correction. Last post should be:

.... So I close the calendar by clicking the right down arrow once again ....
#10
Usually month control works together with date picker control. In your case, I think, is used standard month control, but date picker is replaced with some other control. I cannot test it. When I test that macro with standard picker/month controls, without key LR, date picker control is also not updated. But if I activate that window and press Left and Right arrow keys, manually or with key LR, it is updated. You said you could calculate and click arrows n times to change date, so I think key LR here also should work, although not necessary.
#11
Oh well. I am beginning to suspect that the developers of my application intentionally used non-standard controls to make it difficult to automate. It so happens that they sell add-on products that in effect do what I'm trying to do for big $$$$ (their most complete automator is $3000), so I guess it's in their best interests for it not to be easy for the customer to automate.

In that case, I'll just have to do it the hard way with explicit mouse moves.

Thanks again for the effort and the quick responses!


Forum Jump:


Users browsing this thread: 1 Guest(s)