gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1617 Posts in 535 Topics by 779 Members - Latest Member: rhoronjeff@comcast.net November 27, 2022, 09:53:48 PM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  Windows  |  CHANGING THE DEFAULT IN THE MRWE
gfx
gfxgfx
 

Author Topic: CHANGING THE DEFAULT IN THE MRWE  (Read 5508 times)

Frances Rose Bauckham

  • Newbie
  • *
  • Posts: 12
CHANGING THE DEFAULT IN THE MRWE
« on: November 28, 2007, 04:41:16 PM »
CHANGING THE DEFAULT FONT IN THE MRWE


In version 5.0 of Absoft we changed the default font from the SYSTEM_FIXED_FONT to Monospace 821 BT.

I am attempting to do this with version 10.0 and have found the same approach does not work.

Specifically in version 5.0 you set three parameters in the LOGFONT structure as follows:

lf.lfHeight = -13    (note negative sign)
lf.lfWeight = 700  (for bold)

lf.lfFaceName(1) = 77
lf.lfFaceName(2) = 111
lf.lfFaceName(3) = 110
lf.lfFaceName(4) = 111
lf.lfFaceName(5) = 115
lf.lfFaceName(6) = 112
lf.lfFaceName(7) = 97
lf.lfFaceName( 8 ) = 99
lf.lfFaceName(9) = 56
lf.lfFaceName(10) = 50
lf.lfFaceName(11) = 49
lf.lfFaceName(12) = 32
lf.lfFaceName(13) = 66
lf.lfFaceName(14) = 84


hfont = CreatFontIndirect(val(loc(lf)))

This was done in the CHILD module and was coded three times in the sections WM_CREATE, WM_CHAR and WM_PAINT.


However, in Absoft 10.0 I cannnot seem to get this to work.   You can change the font to the MONOSPACE 821 BT (or any other font for that matter) using the FONT menu option subsequently, however, my requirement is to change the DEFAULT font upon entry.


The code for Absoft 10.0 in CHILD.F90 is as follows:

 txtInfo.lf.lfHeight = -13
 txtInfo.lf.lfWeight = 70
 txt.Info.lf.FaceName = "Monospac821 BT"//char(0)

There is probably only need to insert this in the WM_CREATE section.


However this just falls over at execution.   What I have discovered is that any value in txt.lf.lfHeight other than zero will make the MRWE fall over at run-time.     [I have also discovered that for some odd reason a value of 1267144 as lfHeight will also be accepted, but the text displayed is just garbage (displayed at right-angles, with strikethough usually].


The question is has any one else tried to change the default fonts in the MRWE and if so what is the secret please?




Mike Linacre

  • Sr. Member
  • ****
  • Posts: 259
Re: CHANGING THE DEFAULT IN THE MRWE
« Reply #1 on: November 29, 2007, 04:12:39 PM »
Frances, a question to you about MRWE ...
Could you have kept your old Absoft 5 MRWE code and have merely tweaked it for Absoft 10 code compatibility?
I have a heavily modified version of MRWE, and have not yet upgraded to Absoft 10. The idea having to start the MRWE modification process all over again with the "out-of-the-box" Absoft 10 MRWE is daunting, perhaps overwhelming ...

Mark Coxhead

  • Jr. Member
  • **
  • Posts: 82
Re: CHANGING THE DEFAULT IN THE MRWE
« Reply #2 on: December 04, 2007, 12:20:14 PM »
I have Absoft version 10 under evaluation, but having also changed an earlier version of the MRWE to produce a different font – (we had a complaint some years ago that one of our users did not like the zero with a slash through it), I set about implenting the same change in Absoft 10.

My solution does not put values in the global LOGFONT structure referenced by txtInfo.lf, but I created a local structure in  child.f90:


   Record /LOGFONT/ mlf

Then in the paragraph WM_CREATE:

   Commented the call to the ANSI_FIXED_FONT and
              CreateFontIndirect(txtInfo.p_lf)

   Set
 mlf.lfHeight = -13 (with minus sign as you say)
mlf.lfWeight = 700 (for bold)
               mlf.lfFaceName = TRIM(“Monospac821 BT”)//char(0)
    
                    myNewFont = CreateFontIndirect(loc(mlf))     (implicit pointer to mlf)
      result = GetObject(myNewFont,sizeof(txtInfo.lf),txtInfo.p_lf)

what seems to happen this transfers the parameters from the local LOGFONT mlf structure and the GetObject transfers the object with the handle myNewFont into the global LOGONT structure txtInfo.p_lf via the pointers.


No changes are needed to paragraphs WM_PAINT or WM_CHAR, LOGFONT details via the SetWindowLong are transferred into these.


At the time of writing this seems to work most effectively.   If the user so desires the font, weight and size can be changed via the drop-down box initiated from the menu.

 


Absoft User Forum  |  Support  |  Windows  |  CHANGING THE DEFAULT IN THE MRWE
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!