adjust zoom in xBrowse

Post Reply
INFORMAISVRB
Posts: 55
Joined: Tue Mar 23, 2010 12:53 pm
Contact:

adjust zoom in xBrowse

Post by INFORMAISVRB »

Adjust the zoom in xBrowse Hello friends, is it possible to have this control to adjust the Zoom of Xbrowse

Friends, would you have an Example

https://i.ibb.co/bRz7621x/zzzzzzzzzzzzz ... zzzzzz.jpg

Image
User avatar
Otto
Posts: 6410
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: adjust zoom in xBrowse

Post by Otto »

What exactly do you want to do with Zoom?
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: adjust zoom in xBrowse

Post by nageswaragunupudi »

First, please try pressing Ctrl+ and Ctrl- keys and see the changes. Are you looking for effect similar to this? or something else?

Press Controll key and + of - on the numeric keypad
Regards

G. N. Rao.
Hyderabad, India
INFORMAISVRB
Posts: 55
Joined: Tue Mar 23, 2010 12:53 pm
Contact:

Re: adjust zoom in xBrowse

Post by INFORMAISVRB »

Hello friends, thanks for replying


I need exactly what "Ctrl+ and Ctrl- and" do, but I want to Save this Status, so that the user can choose the Zoom size, preferably allowing it to be Saved together with "SaveState() and :RestoreState(cState)"


:D
INFORMAISVRB
Posts: 55
Joined: Tue Mar 23, 2010 12:53 pm
Contact:

Re: adjust zoom in xBrowse

Post by INFORMAISVRB »

I don't know if I applied it correctly, but I need to save the Zoom Status for when I open the Dialog again with Xbrowse, in the last ZOOM
INFORMAISVRB
Posts: 55
Joined: Tue Mar 23, 2010 12:53 pm
Contact:

Re: adjust zoom in xBrowse

Post by INFORMAISVRB »

This company did, I downloaded the demo version where I can see that it does what I need


Link https://www.donorquest.com/
User avatar
Silvio.Falconi
Posts: 7152
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: adjust zoom in xBrowse

Post by Silvio.Falconi »

INFORMAISVRB wrote: Thu Feb 27, 2025 11:46 am This company did, I downloaded the demo version where I can see that it does what I need


Link https://www.donorquest.com/
this sample test make the zoom and save it on state

Image


Code: Select all | Expand

#include "fivewin.ch"

function Main()   
   local oDlg, oFont, oBrw
   local cSection :="Cust"
local cIniUser :=  cFilePath( GetModuleFileName( GetInstance() ) ) + "test.ini"

local cState := GetPvProfString(cSection, "State","", cIniuser)  // load state from disk

   USE CUSTOMER

DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15   

DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont ; 
     TITLE "Ctrl + MouseWheel Scroll to ZOOM/UNZOOM"   

@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;    
  DATASOURCE ALIAS() AUTOCOLS ;  
    CELL LINES NOBORDER 

  WITH OBJECT oBrw  
    :CreateFromCode()  
 END   

 oBrw:RestoreState( cState )  // set the old state saved 

 ACTIVATE DIALOG oDlg CENTERED ;
 VALID (oBrw:nLen := 0 ,;
     WritePProString(cSection,"State",oBrw:SaveState(),cIniUser))  // save the state into disk

                   
 RELEASE FONT oFont
return nil



Nages,
If I Use this configuration on xbrowse

Code: Select all | Expand

@ 103 , 10 XBROWSE oBrw ;
                  OF oDlg ;
                SIZE -10 , 390 ;
               PIXEL ;
          DATASOURCE oDbf ;
             COLUMNS aCols ;
            AUTOSORT ;
                FONT oFontNormal ;
            NOBORDER ;
                CELL ;
               LINES ;
              UPDATE
              
MyStyleBrowse(oBrw)

   WITH OBJECT oBrw
  
      :CreateFromCode()
   END
   
   
   Function MyStyleBrowse(oBrw)
   local nColorHeader  := DLG_nColorDlg
   local nColorFooter  := DLG_nColorDlg
   local nColorPigiama := RGB(235,243,245)
         WITH OBJECT oBrw
            :nRowHeight          := 25
            :l2007               := .F.
            :l2015               := .T.
            :lRecordSelector     := .F.
            :nColDividerStyle    := LINESTYLE_LIGHTGRAY
            :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
            :nStretchCol         := STRETCHCOL_WIDEST
            :nMarqueeStyle        := MARQSTYLE_HIGHLROW
            :lDisplayZeros        := .f.
            :lAllowRowSizing     := .F.
            :lAllowColSwapping   := .F.
            :lAllowColHiding     := .F.
            :lAllowSizings       := .F.
             :lDrawBorder := .t.
             :nClrBorder := Rgb(195,195,185)
             :lDrawBorderIn   := .F.
            :bRecSelHeader    := ""
       *     :bClrSelFocus := { || {,rgb(255,255,224)}}
            :bClrRowFocus := { || {, rgb(255,255,224)}}
           * :nRecSelColor     :=   nRgb( 245,244,234)
            :bClrHeader       := {|| { ,nColorHeader } }
            :bClrFooter       := {|| { ,nColorFooter } }
            :bClrStd := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, CLR_WHITE,nColorPigiama ) } }
         END
 return nil

the zoom not run also if I use mousewhhel or keys ctrl + and -

probably there is something that is bothering you and the zoom does not work using the mouse wheel or using the + and - keys with ctrl
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Otto
Posts: 6410
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: adjust zoom in xBrowse

Post by Otto »

Hello,
I think it should work approximately like this. In my code, there is still an issue with the correct size of the restored font.
But I’m sure you can solve that.

The principle is: remember the font size, row height, and column widths from XBrowse.
When restarting, the saved values are loaded.
Best regards,
Otto

Code: Select all | Expand


// Using Windows 7 row selection colors in xbrowse

#include 'fivewin.ch'
#include 'xbrowse.ch'


STATIC nLastFontSize := 0
STATIC aLastColWidths := {}
STATIC nLastRowHeight := 0
STATIC c_path

function Main()

   local oDlg, oBrw, oFont

	c_path := cFilePath(GetModuleFileName( GetInstance() ) )
   SET DATE ITALIAN
   SET CENTURY ON

   FwNumFormat( 'E', .t. )

   USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Windows 7 Bars' ;
      COLOR CLR_BLACK,RGB(250,250,250)
          @ 0,20 ;
      BUTTON "SaveZoomSetting" ;
      ACTION SaveZoomSetting( oBrw ) ;
          OF oDlg ;
       PIXEL

      @ 0,120 ;
      BUTTON "LoadZoomSettings" ;
      ACTION LoadZoomSettings( oBrw ) ;
          OF oDlg ;
       PIXEL

   @ 20,20 XBROWSE oBrw OF oDlg SIZE -10,-20 PIXEL ;
      COLUMNS "First", "State", "Age", "HireDate", "Salary" ;
      ALIAS 'CUST' NOBORDER

   oBrw:lRecordSelector := .f.
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7

   WITH OBJECT oBrw:InsCol( 1 )

      :cHeader       := " "
      :bEditValue    := { || If( AScan( oBrw:aSelected, oBrw:BookMark ) > 0, .t., nil ) }
      :SetCheck()
      :nHeadBmpNo    := { || If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }
      :bLClickHeader := { |r,c,f,oCol| If( Len( oBrw:aSelected ) == oBrw:nLen, ;
                                           oBrw:SelectNone(), oBrw:SelectAll() ) }

   END

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil



FUNCTION SaveZoomSetting( oBrw )
	LOCAL cIniFile := c_Path + "PROJECT.INI"


   LOCAL nZoom, i
	local cFontText


	FontToText( oBrw:oFont )

  MEMOWRIT( 'fontsave.txt', cFontText )




   // Schriftgröße speichern
   WritePProString(  "Settings","FontSize", Str( Abs( oBrw:oFont:nHeight ) ), cIniFile )

   // Zeilenhöhe speichern
   WritePProString ( "Settings", "RowHeight", Str( oBrw:nRowHeight ) , cIniFile )

   // Spaltenbreiten speichern
   FOR i := 1 TO Len( oBrw:aCols )
      WritePProString(  "Columns", "Col" + Str(i), Str( oBrw:aCols[i]:nWidth ) , cIniFile )
   NEXT
RETURN NIL


FUNCTION LoadZoomSettings( oBrw )
   LOCAL cIniFile := c_Path + "PROJECT.INI"
   LOCAL i, nWidth

   // Schriftgröße setzen
   LOCAL nFontSize := Val( GetPvProfString( "Settings", "FontSize", "12"  , cIniFile ) )

     oBrw:oFont   :=   FontFromText( MemoRead( 'FONTSAVE.TXT' ) )


   // Zeilenhöhe setzen
   oBrw:nRowHeight := Val( GetPvProfString( "Settings", "RowHeight", "20"  , cIniFile ))

   // Spaltenbreiten wiederherstellen
   FOR i := 1 TO Len( oBrw:aCols )
      nWidth := Val( GetPvProfString( "Columns", "Col" + Str(i), Str(oBrw:aCols[i]:nWidth)  , cIniFile ))
      oBrw:aCols[i]:nWidth := nWidth
   NEXT

   oBrw:Refresh()

RETURN NIL

function FontToText( oFont )
return FW_ValToExp(  { ;
   oFont:cFaceName, 0, oFont:nInpHeight, .f., oFont:lBold, oFont:nEscapement, ;
   oFont:nOrientation, nil, oFont:lItalic, oFont:lUnderline, oFont:lStrikeOut, ;
   oFont:nCharSet, oFont:nOutPrecision, oFont:nClipPrecision, oFont:nQuality, ;
   nil, oFont:nPitchFamily }  )
//----------------------------------------------------------------------------//
function FontFromText( cText )
return HB_ExecFromArray( TFont(), "NEW", &cText )
//----------------------------------------------------------------------------//






********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Post Reply