PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Calendar on Multi-Line  (Read 312 times)

bbssupport

  • Silver Member
  • ***
  • Posts: 20
    • View Profile
Calendar on Multi-Line
« on: December 15, 2020, 09:09:45 PM »
Hi All,

We would like to be able to initiate the built in calendar pop up on multi-lines from within our own code. Is this possible?

The reason is that we use embedded query buttons that activate via the F2 key (not SHIFT-F2) and the built in calendar options in nomads only allow for the button to be external and don't initiate on an F2 like all our other queries do.

Thanks in advance.

Chris

michaelgreer

  • Gold Member
  • ****
  • Posts: 55
    • View Profile
Re: Calendar on Multi-Line
« Reply #1 on: December 16, 2020, 09:03:31 AM »
See the PxPlus manul under Multi_line, or search on calendar:

The Calendar feature may be set up using the HLP= option as follows:


MULTI_LINE ctl_id, @(col,ln,wth,ht)),HLP="[Calendar]parameters$"

The parameter list (parameters$) can consist of any of the following options separated by semi-colons:


CALENDAR=YES | NO
 
YES turns on the Calendar support. NO turns it off. Default is NO.
 

CONTENTS=string$
 
Text or graph appearing on the button. Default is "{!DATE}".
 

DTE=date$
 
Date formatting rules. Default is based on the DTE( ). Semi-colon cannot be part of this parameter. (If used, the string following will be ignored.)

 Date code should include % percent; however, if not used, input will be parsed based on format provided. If a time formatting string is included, the current time is used.
 

HEIGHT=num
 
Height of the button. Default is the height defined for MULTI_LINE.
 

SHOWBUTTON=YES | NO
 
YES shows the Calendar button. NO hides it. Default is YES.
 

WIDTH=num
 
Width of the button. Default width is equal to the height defined for the MULTI_LINE; i.e. the default size is a square.
 

The 'Calendar$ property can also be used (with the above parameter list):


ML_Ctl'Calendar$="CALENDAR=YES;DTE=%Y%M%D;Contents={!Stop}Stop;Width=10".

When invoked, the top border of the calendar popup will be aligned with the bottom border of the multi-line input area. If parameters are not specified, the default button contents will be {!DATE} and the width and height of the button equal to the height of the control itself.

The following methods can be used to invoke the calendar:
•When the multi-line input area has focus, press Shift-F2. In this case, CTL=-6 is suppressed.


•Use the mouse or touchpad to click on the calendar button.

The calendar will disappear automatically when:
•A date is selected and placed in the multi-line input area.


•An ESC is pressed.


•The user clicks anywhere outside the button or calendar.

When the button is clicked, no EOM value will be generated, as the button is considered part of the MULTI_LINE directive and is handled internally. When a date is inserted into the multi-line input area, no EOM value will be generated unless OPT="A" has been set and focus is on the MULTI_LINE control.

The calendar popup displays the following features:
•A grid-like format makes it easy to distinguish the days of the month.


•The text and background of the current date, as well as the current selection, are presented in a different color for clear identification.


•Previous/Next month arrow buttons allow the user to browse through the months of the currently selected year.


•To see the entire month at a glance, the last day(s) of the previous month and the first day(s) of the next month are displayed.

When the MULTI_LINE is hidden or disabled, the calendar button should also be hidden or disabled, and Shift-F2 will not display the calendar control.

Example:

The following code sample invokes the Calendar feature using both methods: the HLP= string and the Calendar$ property.


0010 PRINT 'DIALOGUE'(0,0,100,50,"test",OPT="*Z")
 0020 PRINT '4D','CS'
 0030 LET A=1000
 0040 MULTI_LINE A,@(10,10,30,1),HLP="[CALENDAR]CALENDAR=YES"
 0050 LET B=1001
 0060 MULTI_LINE B,@(10,20,30,1)
 0070 LET B'CALENDAR$="CALENDAR=YES;DTE=%Y %Ml %D;Contents=Enter Date;Width=10"
 0080 PRINT "A: ",A'CALENDAR$
 0090 PRINT "B: ",B'CALENDAR$
 0100 OBTAIN (0,SIZ=1)'ME',A$,'MN',; LET C=CTL; LET E$=HTA(EOM); PRINT "CTL=",C," EOM=",E$
 0110 IF C=4 THEN ESCAPE
 0120 GOTO 0100

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 248
    • View Profile
    • PVX Plus Technologies
Re: Calendar on Multi-Line
« Reply #2 on: December 16, 2020, 09:17:38 AM »
Chris,
To access a calendar with an embedded query button, you can assign the query to the multiline as follows:
Query Type: Panel
Library: *win/calendar.*
Panel: calendar


The Query Button Options are available if you assign the calendar query this way. You can assign !Calendar as the bitmap, and whatever attributes you want.


(Note: This calendar may have a slightly different appearance, but basically works the same way.)
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

bbssupport

  • Silver Member
  • ***
  • Posts: 20
    • View Profile
Re: Calendar on Multi-Line
« Reply #3 on: December 16, 2020, 01:46:44 PM »
Hi Jane,

Thank you, that's perfect. I can definately work with that and can even customize the panel to our needs.

Chris