Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 17 OCT 2008 04:42:18PM Richard Hunt wrote:

I have an option for the user to select the font size on the forms. Basically three different font sizes. I got the basics down. Resizing the form, controls fonts and sizes, and proportionally positioning the controls on the form.

Something has come up. I have one form with the window properties having the number of pages being 4. This form seems to position the controls on page one correctly, although it seems to have a problem with the pages that are greater than 1. the size property "Y" (Offset from the top of the window) value seems to be different. This causes the controls to appear way to far down the form on those pages.

I guess my real question is… How to understand the "Y" value in the size property on pages greater than 1. This will allow me to modify the value so I can proportionally size the controls correctly.

This has become a very useful and popular feature, so I would appreciate any help I can get on this multi page "Y" value issue.


At 17 OCT 2008 07:10PM Richard Hunt wrote:

Maybe this formula to calculate the offset might work…

ORIGINAL_SIZE=(FOCUS,'ORIG_SIZE')

PAGE_NUMBER=FIELD(ORIGINAL_SIZE,':',2)

PAGE_OFFSET=GETSYSTEMMETRICS(17) * PAGE_NUMBER


At 18 OCT 2008 12:09PM Leon Shaffer wrote:

That sounds like a really neat tool. Would you mind posting some code?


At 20 OCT 2008 04:09PM Richard Hunt wrote:

Since I have received so much support from others, I would not mind sharing this. Although understand that it seems to work for my forms and controls. If you see some enhancement ideas, I would sure would be interested in hearing about them.

Note that there is a function called "EDITTABLE", just comment out that line of code. It is my edit table handler and is not necessary to complete the intended purpose.

Note that there is an "UDC_UPPER" user defined conversion. Just replace the sentence with a lower to upper case conversion.

Note that I replaced my $INSERT statement with variable assignments. I think I equated them all.

Note that GETSYSTEMMETRICS(17) is "Height of client area". I am not sure if this is the correct item to calculate page size, although it seems to be.

FUNCTION FONT_WINDOW(ARG1)

* Program: FONT_WINDOW

* Module: PROCEEDURE

* Audit trail. * Mod.0 09/06/06 Modify font and control size. *

* Declare statements.

DECLARE FUNCTION EDITTABLE, GETSYSTEMMETRICS, GET_PROPERTY, SET_PROPERTY

*

* Set program variables. OTHERWISE$=1 NOTHING$=' RM$=@RM SM$=@SVM WINDOW=@WINDOW RESULT=NOTHING$ FONT_SIZE=OCONV(ARG1,'UDC_UPPER') CONTROLS=NOTHING$ OPTIONS=NOTHING$ VALUES=NOTHING$ *

* Verify font size is valid.

BEGIN CASE
  CASE FONT_SIZE EQ 'L'
  CASE FONT_SIZE EQ 'M'
  CASE FONT_SIZE EQ 'X'
  CASE OTHERWISE$
    FONT_SIZE=NOTHING$
END CASE

*

* Calculate large font size modifiers. BEGIN CASE CASE FONT_SIZE EQ 'L' POINT_SIZE=10 MS_FONT_HEIGHT=-13 MS_FONT_WIDTH=7 MS_FONT_SUFFIX=13:SM$:3:SM$:0:SM$:14 COURIER_FONT_HEIGHT=-13 COURIER_FONT_WIDTH=8 COURIER_FONT_SUFFIX=12:SM$:3:SM$:0:SM$:9 COURIER_FONT_HEIGHT=-15 COURIER_FONT_WIDTH=9 COURIER_FONT_SUFFIX=13:SM$:2:SM$:0:SM$:10 WIDTH_RATIO=1.25 HEIGHT_RATIO=1.25 *

* Calculate medium font size modifiers.

  CASE FONT_SIZE EQ 'M'
    POINT_SIZE=8
    MS_FONT_HEIGHT=-11
    MS_FONT_WIDTH=5
    MS_FONT_SUFFIX=11:SM$:2:SM$:0:SM$:11
    COURIER_FONT_HEIGHT=-12
    COURIER_FONT_WIDTH=7
    COURIER_FONT_SUFFIX=12:SM$:3:SM$:0:SM$:8
    WIDTH_RATIO=1
    HEIGHT_RATIO=1

*

* Calculate extra large font size modifiers. CASE FONT_SIZE EQ 'X' POINT_SIZE=12 MS_FONT_HEIGHT=-16 MS_FONT_WIDTH=8 MS_FONT_SUFFIX=16:SM$:4:SM$:0:SM$:16 COURIER_FONT_HEIGHT=-15 COURIER_FONT_WIDTH=9 COURIER_FONT_SUFFIX=13:SM$:2:SM$:0:SM$:10 WIDTH_RATIO=1.5 HEIGHT_RATIO=1.25 *

* Calculate default font size modifiers.

  CASE OTHERWISE$
    POINT_SIZE=8
    MS_FONT_HEIGHT=-11
    MS_FONT_WIDTH=5
    MS_FONT_SUFFIX=11:SM$:2:SM$:0:SM$:11
    COURIER_FONT_HEIGHT=-12
    COURIER_FONT_WIDTH=7
    COURIER_FONT_SUFFIX=12:SM$:3:SM$:0:SM$:8
    WIDTH_RATIO=1
    HEIGHT_RATIO=1
END CASE

*

* Get list of focuses. FOCUSES=GET_PROPERTY(WINDOW,'CTRLMAP') FOCUSES=INSERT(FOCUSES,1,0,0,WINDOW) FOCUS_POS=FALSE$ MORE_FOCUSES=(FOCUSES NE NOTHING$) LOOP WHILE MORE_FOCUSES REMOVE FOCUS FROM FOCUSES AT FOCUS_POS SETTING MORE_FOCUSES *

* Get control information.

  RESULT=GET_PROPERTY(FOCUS:RM$:FOCUS:RM$:FOCUS:RM$:FOCUS,'FONT':RM$:'SIZE':RM$:'TYPE':RM$:'ORIG_SIZE')
  FONT=FIELD(RESULT,RM$,1)
 ][size=FIELD(RESULT,RM$,2)
  TYPE=FIELD(RESULT,RM$,3)
  ORIG_SIZE=FIELD(RESULT,RM$,4)

*

* Check for courier new font. IF OCONV(FONT,'UDC_UPPER') EQ 'COURIER NEW' THEN FONT=COURIER_FONT_HEIGHT FONT=COURIER_FONT_WIDTH FONT=FIELD(FONT,SM$,1,12):SM$:COURIER_FONT_SUFFIX END ELSE *

* Check for any other font.

    FONT=MS_FONT_HEIGHT
    FONT=MS_FONT_WIDTH
    FONT=FIELD(FONT,SM$,1,12):SM$:MS_FONT_SUFFIX
  END

*

* Resize edit table. BEGIN CASE CASE TYPE EQ 'EDITTABLE' SIZE=SIZE * WIDTH_RATIO PAGE_NUMBER=FIELD(ORIG_SIZE,':',2) PAGE_HEIGHT=GETSYSTEMMETRICS(17) * 2 SIZE=SIZE - (PAGE_NUMBER * PAGE_HEIGHT) SIZE=SIZE * HEIGHT_RATIO SIZE=SIZE + (PAGE_NUMBER * PAGE_HEIGHT) SIZE=SIZE * WIDTH_RATIO SIZE=SIZE * HEIGHT_RATIO RESULT=SET_PROPERTY(FOCUS:RM$:FOCUS,'FONT':RM$:'SIZE',FONT:RM$:SIZE) IF FOCUS-6,6 EQ '_TOTAL' THEN ET_FOCUS=FOCUS1,LEN(FOCUS) - 6 END ELSE ET_FOCUS=FOCUS END RESULT=EDITTABLE(ET_FOCUS,'SIZE',NOTHING$) *

* Ignore menu type controls.

    CASE TYPE EQ 'MENU'

*

* Resize window. CASE TYPE EQ 'WINDOW' SIZE=SIZE * WIDTH_RATIO SIZE=SIZE * HEIGHT_RATIO CONTROLS := RM$:FOCUS:RM$:FOCUS OPTIONS := RM$:'SIZE':RM$:'FONT' VALUES := RM$:SIZE:RM$:FONT *

* Resize all other control types.

    CASE OTHERWISE$
      SIZE=SIZE * WIDTH_RATIO
      PAGE_NUMBER=FIELD(ORIG_SIZE,':',2)
      PAGE_HEIGHT=GETSYSTEMMETRICS(17) * 2
      SIZE=SIZE - (PAGE_NUMBER * PAGE_HEIGHT)
      SIZE=SIZE * HEIGHT_RATIO
      SIZE=SIZE + (PAGE_NUMBER * PAGE_HEIGHT)
      SIZE=SIZE * WIDTH_RATIO
      SIZE=SIZE * HEIGHT_RATIO
      CONTROLS := RM$:FOCUS:RM$:FOCUS
      OPTIONS := RM$:'SIZE':RM$:'FONT'
      VALUES := RM$:SIZE:RM$:FONT
  END CASE
REPEAT

*

* Set properties. IF CONTROLS NE NOTHING$ THEN CONTROLS=CONTROLS2,99999 OPTIONS=OPTIONS2,99999 VALUES=VALUES2,99999 RESULT=SET_PROPERTY(CONTROLS,OPTIONS,VALUES) END *

* Return result.

RESULT=FONT_SIZE
RETURN RESULT

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/044d2f3fdcda1801852574e50071bc89.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1