GRID.ChangeFontSize / LISTVIEW_SETCOLUMNWIDTH()

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

GRID.ChangeFontSize / LISTVIEW_SETCOLUMNWIDTH()

Post by AUGE_OHR »

hi,

i found GRID.ChangeFontSize and now i can "dynamic" set FONT Size when re-size :D
there is also LISTVIEW_SETCOLUMNWIDTH() so when maximize GRID i also can change Wide of each Column.

btw. when Click on Line between GRID Header Item it will automatic "optimize" Column wide

---

have play with

Code: Select all

  GRID &cGrid ;
  PARENT &cForm ;
  FONT "Arial" SIZE 11 ;

FUNCTION DoReSize(cForm,cGrid)
  nZoom := NewHeight/OriginalHeight
  Setproperty( cForm , cGrid, "ChangeFontSize",ROUND(nZoom*11,0))
this is with 100 % Scale and Start with 1280 x 1024
as my Monitor is 1920 x 1200 i just have nZoom := 1,171875 so it is not much Differenz.

when use nZoom*11 = 12,890625‬ i got to 13 so Sign in Full-Screen is bigger

---

to Set wide of Columne i found this Way

Code: Select all

   hGrid := GetControlHandle( cGrid, cForm)
   aCol := ACLONE( SP_aColLeft() ) // have save Original Column wide at create in Array
   jMax := LEN(aCol)
   j := 1
   FOR j := 1 TO jMax
      nWide := aCol[j]*nZoom
      LISTVIEW_SETCOLUMNWIDTH(hGrid, j-1, nWide )
   NEXT
or

Code: Select all

   hGrid := GetControlHandle( cGrid, cForm)
   jMax := LEN(aStruc)  // DBSTRUCT()
   j := 1
   FOR j := 1 TO jMax
      cType := aStruc[ j ] [ DBS_TYPE ]
      DO CASE
         CASE cType = "D"
            nWide := 80 * nZoom
         CASE cType = "L"
            nWide := 30 * nZoom
         OTHERWISE
            nWide := aStruc[ j ] [ DBS_LEN ] * 11 * nZoom
      ENDCASE
      LISTVIEW_SETCOLUMNWIDTH(hGrid, j-1, nWide )
   NEXT
i play with

Code: Select all

FONT "Arial" SIZE 11
so if use other Font / Size / Scale you might get other Result

what do you think about that Concept :?:
have fun
Jimmy
User avatar
serge_girard
Posts: 3364
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: GRID.ChangeFontSize / LISTVIEW_SETCOLUMNWIDTH()

Post by serge_girard »

Looks good !

You have a working sample?

Serge
There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: GRID.ChangeFontSize / LISTVIEW_SETCOLUMNWIDTH()

Post by AUGE_OHR »

hi,
serge_girard wrote: Thu Jan 30, 2020 5:38 pm You have a working sample?
it is Part of HBFM and i still work on it.
have made a Sample from Code ... need to be tested.
SETCOLUMNWIDTH.ZIP
(2.41 KiB) Downloaded 121 times
have fun
Jimmy
Post Reply