Highlighted
Absent Member.
Absent Member.
2122 views

[archive] Calendar again

[Migrated content. Thread originally posted on 29 January 2003]

I am using Active-X control ?Calendar Control 8.0? . I display a floating window in which the control occurred. I would like to be able to close the window when the CalendarDblClick method occurs. Please, help me!!!!
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

It is rather difficult to propose anything here without any source to look at.
I suggest you contact Technical Support with sample source at hand, or, if you are able to provide this in a small sample you could post it here so we can see what you are trying to achieve.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

77 CALENDAR-WINDOW HANDLE OF WINDOW.
?
01 CALENDAR-SCN.
03 CALENDAR-ITEM Calendar
LINE 0.5 COL 0.5 SIZE 40 CELLS LINES 14.0,
EVENT PROCEDURE IS CALENDAR-EVENT-HANDLER..
??
SHOW-CALENDAR SECTION.

MOVE MY-DATE TO DATUM-1.
DISPLAY FLOATING WINDOW LINE 1 COL 1
SIZE 39 LINES 9.5
ERASE COLOR 257 BACKGROUND-LOW
TITLE TITLE-CALENDAR
SYSTEM MENU
BOXED, HANDLE IN CALENDAR-WINDOW.

MOVE 1 TO ACCEPT-CONTROL CONTROL-VALUE.
MOVE 0 TO KEY-INPUT.
DISPLAY CALENDAR-SCN.

MODIFY CALENDAR-ITEM Day = DD.

SHOW-CALENDAR-SCN.

PERFORM UNTIL ESC-PUSH OR EXIT-WINDOW
ACCEPT CALENDAR-SCN ON EXCEPTION
IF EVENT-OCCURED
EVALUATE EVENT-TYPE
WHEN CMD-CLOSE
SET EXIT-WINDOW TO TRUE
END-EVALUATE
END-IF
END-ACCEPT
END-PERFORM.

DESTROY CALENDAR-WINDOW.
MOVE 0 TO KEY-INPUT.
MOVE 1 TO ACCEPT-CONTROL.

SHOW-CALENDAR-END.
********
CALENDAR-EVENT-HANDLER SECTION.

EVALUATE EVENT-TYPE
WHEN MSG-AX-EVENT
EVALUATE EVENT-DATA-2
WHEN CalendarDblClick
INQUIRE CALENDAR-ITEM, Day IN DAY1,
Month IN MONTH1, Year IN YEAR1
MOVE DATE-1 TO MY-NEW-DATE
END-EVALUATE.

CALENDAR-EVENT-HANDLER-END.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

assuming you use SCREEN-CONTROL (sample\def\crtvars.def)
In your double click part of the event, set ACCEPT-CONTROL to 0, and your accept terminates.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

My accept not terminates with set ACCEPT-CONTROL to 0.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

Difficult to state precisely what you're looking for, but try this:

IDENTIFICATION DIVISION.

PROGRAM-ID. Calendar-Demo.
ENVIRONMENT DIVISION.
SPECIAL-NAMES.
COPY "CALENDAR.DEF".
.
WORKING-STORAGE SECTION.
COPY "CRTVARS.DEF".
COPY "ACUGUI.DEF".
77 CALENDAR-WINDOW HANDLE OF WINDOW.
77 PROG-ACTION PIC 9.
88 FINISH-NOW VALUE 1.
77 KEY-STATUS
IS SPECIAL-NAMES CRT STATUS PIC 9(4) VALUE 0.
88 EXIT-PUSHED VALUE 27.
88 EVENT-OCCURED VALUE 96.

SCREEN SECTION.
01 CALENDAR-SCN.
03 CALENDAR-ITEM Calendar
LINE 1
COL 1
SIZE 40
LINES 14
EVENT PROCEDURE CALENDAR-EVENT-HANDLER.

PROCEDURE DIVISION.
MAIN-LOGIC.

DISPLAY STANDARD GRAPHICAL WINDOW
LINES 10
SIZE 30
BACKGROUND-LOW
TITLE "Empty window...".

DISPLAY FLOATING WINDOW
LINE 1
COL 1
SIZE 40
LINES 14
BACKGROUND-LOW
TITLE "Calendar Pop-up"
HANDLE IN CALENDAR-WINDOW.

INITIALIZE PROG-ACTION
KEY-STATUS.
DISPLAY CALENDAR-SCN UPON CALENDAR-WINDOW.
PERFORM UNTIL FINISH-NOW OR EXIT-PUSHED
ACCEPT CALENDAR-SCN ON EXCEPTION
IF EVENT-OCCURED
AND (EVENT-TYPE = CMD-CLOSE)
SET EXIT-PUSHED TO TRUE
END-IF
END-ACCEPT
END-PERFORM.

DESTROY CALENDAR-SCN.
DESTROY CALENDAR-WINDOW.
STOP RUN.

CALENDAR-EVENT-HANDLER.

EVALUATE EVENT-TYPE
WHEN MSG-AX-EVENT
EVALUATE EVENT-DATA-2
WHEN CalendarDblClick
SET EVENT-ACTION TO
EVENT-ACTION-TERMINATE
SET FINISH-NOW TO TRUE
END-EVALUATE
END-EVALUATE.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

In my application I have ActiveX control. Now I want to distrubute my application. I have the ActiveX control in the directory where my appication will be installed on the user?s hard disk and I want to call regsvr32 automatically when I use the application and the control is not installed and registrated in the user?s hard disk.
When I try to call the control in my application this message is displaying ?Error creating AcviteX control COBOL error att 00F3C9 in programx.cbl?, because the control is not registred. How I can register the control automatically when I call this in my program?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calendar again

Good question, indeed.

What you would have to do, to catch this, is to introduce an error handler for objects. You do so by adding a section to the DECLARATIVES section:

object-exception section.
use after exception on object.

Assuming your application already do COPY the following files:

activex.def.
winhelp.def.
acugui.def

And has the following variables declared:

77 error-source pic x(30).
77 error-description pic x(50).
77 error-help-file pic x(200).
77 error-help-context usage unsigned-long.
77 choice pic 9.

You could have such a declaratives to catch this:

object-exception section.
use after exception on object.
object-exception-handler.
call "c$excepinfo" using
error-info
error-source
error-description
error-help-file
error-help-context.
evaluate true
when acu-e-initialstate
display message box "INITIAL-STATE"
end-evaluate.
if error-help-file = spaces then
display message box error-description
title error-source
icon mb-error-icon
else
display message box error-description h'0d'
"Do you want help ?"
title error-source
icon mb-error-icon
type is mb-yes-no
default is mb-yes
giving choice
if choice = 1 then
call "$winhelp" using error-help-file,
help-context
error-help-context
end-if
end-if
end declaratives.

Implement this, and this declaratives should catch your error, you should get the message "System Exception" in ERROR-SOURCE and the message "Class not registered" in ERROR-DESCRIPTION.

Then go ahead and find a way to execute the regsvr32 command.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.