none
VFP9 Executable

    Question

  • Hi.  I have a situation where code is behaving differently when compiled into an executable.  Create the following pen.prg:

    && pen.prg

    CLEAR ALL
    CLEAR
    SET CONSOLE OFF
    SET EXACT ON
    set cent on
    set date to dmy
    set mark to '.'
    SET HOURS TO 24
    SET SHADOWS OFF
    SET ESCAPE OFF
    SET HELP On
    SET TALK OFF
    SET HOURS TO 24
    SET SHADOWS OFF
    SET ESCAPE OFF
    SET MENU OFF
    SET VIEW OFF
    SET TALK OFF
    SET MACKEY TO
    SET SYSMENU ON
    SET FUNCTION 10 TO 'clear;'


    PUBLIC ROKADMAINFORM
    rokadmform= CREATEOBJECT('rokadmainform')  && Create a Form
    rokadmform.SHOW  && Display the form

    DO WHILE .t.

    CLEAR
    @ 9,30 say "R. ENTER" font 'ARIAL',15 COLOR RGB(255,0,0)
    @ 12,30 say "Q. QUIT" font 'ARIAL',15 COLOR RGB(255,0,0)

    @ 42.5,0 fill to 43,220 color RGB(150,0,123)
    ch=SPACE(1)
    @ 44,94 get ch PICT '@!N' font 'arial',20 COLOR BG/B size 1,1
    read valid ch#''
    IF ch="R"
    DO ROKAD IN PEN
    ENDIF
    IF ch='Q'
    RELEASE rokadmform
    CLEAR EVENTS
    RELEASE ALL
    EXIT
    RETURN
    ENDIF

    ENDDO

    CLEAR EVENTS
    RELEASE ALL


    PROCEDURE ROKAD
    CLEAR
    DEFINE WINDOW A FROM -150,0 TO 500,150 IN WINDOW ROKADMAINFORM
    ACTIVATE WINDOW  A
    @ 190.3,2 TO 190.3,125 PEN 2 COLOR RGB(255,0,0) STYLE 'T'
    READ
    DEACTIVATE WINDOW A
    RETURN

    DEFINE CLASS rokadmainform AS FORM
    CAPTION = "Rokad Version 1.00"
    SHOWWINDOW = 2
    BorderStyle=2
    ICON="favicon.ICO"
    ControlBox=.t.
    MaxButton=.T.
    MinButton=.t.
    DESKTOP=.t.
    mdiform=.t.
    backcolor=RGB(255,255,255)
    Top = 1.8
    Left = -3
    WIDTH = 1023
    HEIGHT = 690
    PROCEDURE destroy
    CLEAR events
    ENDPROC

    Procedure Load
    KEYBOARD "{CTRL+F10}" PLAIN
    ENDPROC

    PROCEDURE INIT
    ENDPROC

    PROCEDURE QUERYUNLOAD() 
    CH='Q'
    RELEASE rokadmform
    ENDPROC
    ENDDEFINE

    ...careful not to run this code below 1024x768 resolution.  If you run pen.fxp, red line is at top of the window.  Now create project pen and compile into pen.exe.  If you execute pen.exe, red line will be at bottom of window.  At least it is on my Windows 7 machine.  My XP machine runs pen.exe just fine.  If you start VFP9, then DO PEN.EXE, line is at the top of the window.  Strange.  Both machines have VFP9 SP2.  Any ideas?

    Wednesday, April 30, 2014 3:31 PM

Answers

  • @ row,col SAY, GET, TO, PROMPT, FILL etc are deprecated commands.

    Many things have changed: VFP uses gdiplus to draw. Windows Vista introduced Aero, VFP7 introduced reacting to Windows Themes.

    Don't expect this to work consistent on all of these environments with all of the things having changed since Fox 2.6

    Should we go into details? As you don't even say which behaviour you would like, adressing the detail problem is a moot point. VFP is not downward compatible to every single pixel, especially when things are stated as deprecated  in the help file you won't get any support for this for over two decades.

    Bye, Olaf.


    Olaf Doschke - TMN Systemberatung GmbH

    http://www.tmn-systemberatung.de

    Wednesday, April 30, 2014 5:27 PM

All replies

  • @ row,col SAY, GET, TO, PROMPT, FILL etc are deprecated commands.

    Many things have changed: VFP uses gdiplus to draw. Windows Vista introduced Aero, VFP7 introduced reacting to Windows Themes.

    Don't expect this to work consistent on all of these environments with all of the things having changed since Fox 2.6

    Should we go into details? As you don't even say which behaviour you would like, adressing the detail problem is a moot point. VFP is not downward compatible to every single pixel, especially when things are stated as deprecated  in the help file you won't get any support for this for over two decades.

    Bye, Olaf.


    Olaf Doschke - TMN Systemberatung GmbH

    http://www.tmn-systemberatung.de

    Wednesday, April 30, 2014 5:27 PM
  • Sorry.  The user would always like to see the red line at the top of the window.  I added "_screen.Themes = .F.", no change.  If I have vfp9 running by itself, then when I run the executable, the red line stays at the top.

    You're right.  Probably a bad command.  Maybe the @ fill to.

    Thursday, May 01, 2014 2:33 AM
  • Hi,

          I think Environment Variables or System Variables should be same as VFP starts same thing in PEN.EXE.

    How to set same  Environment Variables or System Variables to executable EXE file.

    The problem is in DEFINE WINDOW A FROM -150,0 TO 500,150 IN WINDOW ROKADMAINFORM

    The coordinates changes it position when PEN.EXE starts alone. without vfp9 window

    There is not mistake in

    @ row,col SAY, GET, TO, PROMPT, FILL

    or

    @ 190.3,2 TO 190.3,125 PEN 2 COLOR RGB(255,0,0) STYLE 'T'

    When the window DEFINE WINDOW A FROM nRow1 GOES to -1 (negative value) the problem arises.

    Strange. Any  idea

    Solve it

    Sachin

     

     

    Thursday, May 01, 2014 11:03 AM
  • Your code works fine on my Windows 7 machine. (Both variants.)

    You should set font and font sizes in your windows definitions and in _screen.

    DEFINE WINDOW ... FROM ... TO  positions the window based on the parent window font size.

    Of course, you should redesign your code to use OO approach more strictly. CREATEOBJECT works together with DEFINE WINDOW but it is not so obvious today.

    Thursday, May 01, 2014 7:39 PM
    Moderator