I opened an example app and added a calender control for you.
I found the following code
!=====================================================
CASE ACCEPTED()
!..... <many lines here, for other controls>
OF ?Calendar
ThisWindow.Update
! Start of "Control Event Handling"
Calendar6.SelectOnClose = True
Calendar6.Ask('Select a Date')
!<embed point>
IF Calendar6.Response = RequestCompleted THEN
END
ThisWindow.Reset(True)
!<embed point>
!=====================================================
So you can use either of the two !<embed point>s
Or you could derive Calendar6.Ask, and check the SELF.Response AFTER the parent call
You can derive a couple of ways.
a) The simplest way is to use the embed points to add content within the Calender6.Ask method. If you look at the generated code. You'll see that Calender6 is itself derived from a CalenderClass
Calendar6 CLASS(CalendarClass)
When you add code to one (or more) of the embed points inside of a method, the generated code will add the derived method to your procedure, when it's not present then it's implied that it's JUST the Parent version of the method.
Looking at the embeditor it's apparent to me that the Calender Button Template is not as written as it should be (I had similar feelings when I looked at the source code for CalendarClass found in %cwroot%\libsrc\abutil.clw). The template does not genearte a call to the parent for you, so you will want to add the call to the parent:
ReturnValue = PARENT.Ask(pTitle, pDate)
IF SELF.Response = RequestCompleted
!OK was pressed
ELSE
!Cancel or ESC etc. occurred
END
b) If you know you're going to need the same changes a number of times, then you should consider writting an .INC / .CLW for the class (which is NOT as hard as you might guess -- I write them ALL the time, let me know if you'd like to learn how to write one) Then once you have this new version of the class, you will want to put it the %cwroot%\LIBSRC folder, and press the "Refresh Application Builder Class Information" button in the the IDE, once that's done you will want to replace the CalenderClass as the Base Class.
OK, step by step.
a) get to the window formatter
b) Add your calendar button template control
c) Open the properties for the control
d) Classes Tab
e) Uncheck "Use Default ABC: CalendarClass
f) Notice the the Base Class Drop Down is now enabled
g) Pick your new class from the Base Class drop down
(that's why you had to refresh, to get your class added to this list)
h) If you new class isn't in the Base Class drop down list, then press, Refresh Application Builder Class Information. And look again.
i) Hit OK a few times.
Note: If you want to use your version of the class throughout your APP, then you should instead to go to the application's global properties, and select you new Class from via the Classes tab. This will alter you the class that a given object is derived from throughout the APP.
For instance, if you wished to replace WindowManager with MyNewAndImproved_WindowManager then you could make the change once at the global level.
Then the generated code would show:
ThisWindow CLASS(MyNewAndImproved_WindowManager) !etc.
Instead of the familiar:
ThisWindow CLASS(WindowManager) !etc.
Replacing the default class at the APP global level is one of the most powerful and CLEAN ways to alter an application. It has the absolute minimal bloat, and gives you the greatest consistency for the least effort.
Getting back to the CalendarClass, you can set the DEFAULT class on Global Properties -> Classes Tab -> General Button -> see "Calendar Class" at the bottom of that window
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.