Maximize Harbour Application

1,021 views
Skip to first unread message

Milan Mehta

unread,
Nov 25, 2015, 12:12:50 AM11/25/15
to Harbour Users
I have just converted one of my application from xHarbour to Harbour.

Two things I noticed :

1. I wish to start the application on Maximize mode. How can I programmatically ? So that user do not have to click on Maximize button.

2. I am not able to change the Font of the application. Previously I could click on Left Hand Size Upper Corner and then on Property Button. But I do not see that option in Harbour application. Can I change the Font now ?

TIA

Milan.

Heinz V Bergen

unread,
Nov 27, 2015, 6:47:36 PM11/27/15
to Harbour Users
if using Windows, see example below, compile with:
HBMK2 Test -gtwvt

//Test.Prg
#INCLUDE "hbgtinfo.ch"
#INCLUDE "inkey.ch"

PROCEDURE main()
Local cText := "Hello World", nKey
SetColor("w+/b")
Set Cursor Off
hb_gtInfo( HB_GTI_ALTENTER, .T. )   // allow <Alt-Enter> for full screen
hb_gtInfo( HB_GTI_CLOSEMODE, 1 )    // 1 - sends HB_K_CLOSE on Window x-Close
hb_gtInfo( HB_GTI_FONTNAME, "Lucida Console" )
hb_gtInfo( HB_GTI_WINTITLE, "Start Maximized Test" )
hb_gtInfo( HB_GTI_MAXIMIZED, .T. )  //starts in Maximized Window
//hb_gtInfo( HB_GTI_ISFULLSCREEN, .T. )  //starts in FULLSCREEN window
SetMode(15,53)
CLS
@1, (MaxCol()-Len(cText))/2 Say cText
@MaxRow()-1, MaxCol()/2-17 Say "Alt-Enter toggles FULLSCREEN mode." COLOR "gr+/b"
@MaxRow()/2, 8 Say "LastKey() Value: "
@MaxRow()/2, 26 Say Transform( LastKey(), "9999" ) COLOR "n/gr*"
Do While .T.
  nKey := InKey( 0, HB_INKEY_GTEVENT + INKEY_ALL - INKEY_MOVE )  //1278 excludes mouse move
  @MaxRow()/2, 26 Say Transform( LastKey(), "9999" ) COLOR "n/gr*"
  IF nKey == HB_K_CLOSE .OR. nKey == K_ESC
    IF Alert("Quit, are you sure?:",{"Yes","No"}) == 1
      Exit
    ENDIF
  ENDIF
EndDo
RETURN

Maurício Ventura Faria

unread,
Nov 30, 2015, 7:17:39 AM11/30/15
to harbou...@googlegroups.com
Hi.
My piece of code...
[[]] Maurício Ventura Faria


// For 25, 50 and 60 lines x 80 columns

  STATIC FUNCTION ModoWVT(nLines)

     STATIC cFont      := NIL

     LOCAL aIni         := LoadIni()         // Load user preferences from INI
     LOCAL aDefaults    := VtDefaults()
     LOCAL nSize        := 0
     LOCAL nWidth       := 0

     IF cFont == NIL
        IF EMPTY( cFont := ALLTRIM(MEMOREAD( "FONTEWVT.flg" )) )
           cFont     := 'Lucida Console'
        ENDIF
        Hb_GtInfo( HB_GTI_FONTNAME, cFont )
     ENDIF

     IF nLines = 25

        DO CASE
        CASE LEN( aIni ) >= 2
           nSize  := aIni[1,1]
           nWidth := aIni[1,2]
        OTHERWISE
           nSize  := aDefaults[1,1]
           nWidth := aDefaults[1,2]
        END

        // Se não fizer um antes e um depois não funciona.
        SetMode(25,80)

        HB_GTINFO( HB_GTI_FONTSIZE  ,nSize  )
        HB_GTINFO( HB_GTI_FONTWIDTH ,nWidth )

        SetMode(25,80)

     ELSEIF nLines = 50

        DO CASE
        CASE LEN( aIni ) >= 2
           nSize  := aIni[2,1]
           nWidth := aIni[2,2]
        OTHERWISE
           nSize  := aDefaults[2,1]
           nWidth := aDefaults[2,2]
        END

        SetMode(50,80)

        HB_GTINFO( HB_GTI_FONTSIZE  ,nSize  )
        HB_GTINFO( HB_GTI_FONTWIDTH ,nWidth )

        SetMode(50,80)

     ELSEIF nLines = 60

        DO CASE
        CASE LEN( aIni ) >= 2
           nSize  := aIni[3,1]
           nWidth := aIni[3,2]
        OTHERWISE
           nSize  := aDefaults[3,1]
           nWidth := aDefaults[3,2]
        END

        SetMode(nLines,80)

        HB_GTINFO( HB_GTI_FONTSIZE  ,nSize  )
        HB_GTINFO( HB_GTI_FONTWIDTH ,nWidth )

        SetMode(nLines,80)

     ENDIF

    RETURN .T.






STATIC FUNCTION VtDefaults()

   STATIC aDefaults
   STATIC ScreenHeight
   STATIC ScreenWidth

   DEFAULT ScreenHeight := Wvw_GetScreenHeight()
   DEFAULT ScreenWidth  := Wvw_GetScreenWidth()

   IF EMPTY( aDefaults )
      DO CASE
         CASE ScreenWidth >= 1680 .AND. ScreenHeight >= 1050
              aDefaults := { {39,21} , {18,20}, {15,20} }

         CASE ScreenWidth >= 1600 .AND. ScreenHeight >=  900
              aDefaults := { {34,20} , {17,20}, {14,20} }

         CASE ScreenWidth >= 1400 .AND. ScreenHeight >= 1050
              aDefaults := { {38,16} , {19,16}, {15,16} }

         CASE ScreenWidth >= 1280 .AND. ScreenHeight >= 1024
              aDefaults := { {37,15} , {19,16}, {15,16} }

         CASE ScreenWidth >= 1280 .AND. ScreenHeight >=  960
              aDefaults := { {36,16} , {18,16}, {15,16} }

         CASE ScreenWidth >= 1280 .AND. ScreenHeight >=  800
              aDefaults := { {30,16} , {15,16}, {12,16} }

         CASE ScreenWidth >= 1280 .AND. ScreenHeight >=  768
              aDefaults := { {28,16} , {14,16}, {11,16} }

         CASE ScreenWidth >= 1280 .AND. ScreenHeight >=  720
              aDefaults := { {26,16} , {13,16}, {10,16} }

         CASE ScreenWidth >= 1280 .AND. ScreenHeight >=  600
              aDefaults := { {22,16} , {11,16},  {9,16} }

         CASE ScreenWidth >= 1152 .AND. ScreenHeight >=  864
              aDefaults := { {32,14} , {16,14}, {13,14} }

         CASE ScreenWidth >= 1024 .AND. ScreenHeight >=  768
              aDefaults := { {26,14} , {14,12}, {11,12} }

         CASE ScreenWidth >= 1024 .AND. ScreenHeight >= 705
              aDefaults := { {26,12} , {14,12}, {11,12} }

         CASE ScreenWidth >=  800 .AND. ScreenHeight >=  600
              aDefaults := { {22,10} , {11,10},  {9,10} }

         OTHERWISE
              aDefaults := { {18, 8} , { 9, 8}, { 7, 8} }
      ENDCASE
   ENDIF

RETURN aDefaults

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

VS

unread,
Nov 30, 2015, 9:25:22 AM11/30/15
to Harbour Users
milanbhai

please add this code to your software and recomplie using hbmk2 file.prg -gtwvt

SETMODE(25,80)
hb_gtInfo( HB_GTI_ICONFILE, "file.ico" )
hb_gtInfo( HB_GTI_WINTITLE, "my software" )
Hb_GtInfo( HB_GTI_SELECTCOPY,.T.)
HB_GTINFO( HB_GTI_CLOSABLE, .T. )
HB_GTINFO( HB_GTI_RESIZABLE, .T. )
HB_GTINFO( HB_GTI_CODEPAGE, 255 )
Hb_GTInfo(HB_GTI_MOUSESTATUS, 1 )
hb_gtInfo( HB_GTI_ALTENTER, .T. )

hb_gtInfo( HB_GTI_FONTNAME, "Lucida Console" )
hb_gtInfo( HB_GTI_MAXIMIZED, .T. )  //starts in Maximized Window

add line #include "hbgtinfo.ch" before function main()

by adding this code, your clipper program will run as it is without major changes, it also support alt+enter in win 7...!!!!!!!!!!

BUT .... you need to reprogram the printing part of your software

Milan Mehta

unread,
Dec 16, 2015, 5:58:45 AM12/16/15
to Harbour Users
Dear Sir,

Your code worked wonderfully !
Thanks a lot. Harbour is great and your help too !

Milan.
Reply all
Reply to author
Forward
0 new messages