Page 1 of 2

Help creating a Dialog for Tablet Windows

Posted: Mon Aug 14, 2017 6:13 pm
by Silvio.Falconi
Friends,

I 'm creating a dialog for Tablet application with 12 BTNBMP buttons

Image

I not have the tablet also and I not Know the resolution screen of Tablet

I think it can have 1280 x 800 Pixel But I am not sure

I wish create a dialog and it must run good on all resolutions.

How I can make it ?

How I can test a resolution ?
To try any resolution I pass on exe two parameters
sample : Myapp.exe 800 600 and on my Function Main I have

Code: Select all

Function Main(cPar1,cpar2)
Or

I read on a file INI the parameter I need sample :

Code: Select all

nres1=1024
nres2=700

the problem i create the dialog with btnbmp buttons

I make a test but when I change the resolution the buttons not resize .... any solution ?
My small test

Code: Select all

 
#include "FiveWin.ch"

// test creating dialog with btnbmp for tablet menu

Function Test()
Local oDlgTablet
Local aBtnMenu:= array(12)
Local aBtnMenuImage:=array(12)
Local aBtnMenuTitle:=array(12)
Local n
Local oFont

Local nMINWidth  := 800//::cResTablet1
Local nMINHeight := 600//::cResTablet2
Local nMAXWidth := GETSYSMETRICS( 0 ) //risoluzione orizzontale
Local nMAXHeight := GETSYSMETRICS( 1 ) //risoluzione verticale
Local nSizeWBtn :=90
Local nSizeHBtn :=90
Local nSizeWSpace :=20
Local nSizeHSpace :=10
Local cTitle:= "Test menu button Tablet"


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

DEFINE DIALOG oDlgTablet  SIZE nMINWidth,nMINHeight ;
        FONT oFont;
        TITLE cTitle

oDlgTablet:nStyle    := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_MAXIMIZEBOX,   0  )//WS_SYSMENU


For n= 1 to 12

 @ 5,50 BTNBMP aBtnMenu[n] FILE aBtnMenuImage[n] ;
              PROMPT aBtnMenuTitle[n] FLAT SIZE nSizeWBtn,nSizeHBtn ;
                    PIXEL OF oDlgTablet COLOR CLR_WHITE, RGB( 120,136,85 ) ACTION NIL
Next n


 oDlgTablet:aMinMaxInfo = { GETSYSMETRICS( 0 ), GETSYSMETRICS( 1 ),;  // xMaxSize,      yMaxSize
                                                              0,  0,;  // xMaxPosition,  yMaxPosition
                                             nMINWidth,  nMINHeight,;  // xMinTrackSize, yMinTrackSize
                                             nMAXWidth, nMAXHeight }

     oDlgTablet:bResized := { || ;
      oRect          := oDlgTablet:GetCliRect(), ;
      aBtnMenu[1]:nLeft    := oRect:nLeft +10 ,;
      aBtnMenu[2]:nLeft    := oRect:nLeft +nSizeWBtn+nSizeWBtn+15,;
      aBtnMenu[3]:nLeft    := oRect:nLeft +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+20  ,;
      aBtnMenu[4]:nLeft    := oRect:nLeft +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+25,;
      aBtnMenu[5]:nTop     := oRect:nTop  +nSizeWBtn+nSizeWBtn+20,;
      aBtnMenu[5]:nLeft    := oRect:nLeft +10,;
      aBtnMenu[6]:nTop     := oRect:nTop  +nSizeWBtn+nSizeWBtn+20,;
      aBtnMenu[6]:nLeft    := oRect:nLeft +nSizeWBtn+nSizeWBtn+15,;
      aBtnMenu[7]:nTop     := oRect:nTop  +nSizeWBtn+nSizeWBtn+20,;
      aBtnMenu[7]:nLeft    := oRect:nLeft +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+20  ,;
      aBtnMenu[8]:nTop     := oRect:nTop  +nSizeWBtn+nSizeWBtn+20,;
      aBtnMenu[8]:nLeft    := oRect:nLeft +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+25,;
      aBtnMenu[9]:nTop     := oRect:nTop  +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+30,;
      aBtnMenu[9]:nLeft    := oRect:nLeft +10 ,;
      aBtnMenu[10]:nTop    := oRect:nTop  +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+30,;
      aBtnMenu[10]:nLeft   := oRect:nLeft +nSizeWBtn+nSizeWBtn+15,;
      aBtnMenu[11]:nTop    := oRect:nTop  +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+30,;
      aBtnMenu[11]:nLeft   := oRect:nLeft +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+20  ,;
      aBtnMenu[12]:nTop    := oRect:nTop  +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+30,;
      aBtnMenu[12]:nLeft   := oRect:nLeft +nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+nSizeWBtn+25 }

    ACTIVATE DIALOG oDlgTablet //CENTERED
    RETURN NIL


 

Re: Help creating a Dialog for Tablet Windows

Posted: Mon Aug 14, 2017 8:18 pm
by hmpaquito
Perhaps oDlg:bResized is used when dialog is resized clicking corner or lateral or maximized.

Re: Help creating a Dialog for Tablet Windows

Posted: Mon Aug 14, 2017 10:05 pm
by Gale FORd
Don't forget Portrait vs Landscape orientation.

Re: Help creating a Dialog for Tablet Windows

Posted: Tue Aug 15, 2017 7:01 pm
by Silvio.Falconi
Gale FORd wrote:Don't forget Portrait vs Landscape orientation.
How make it ?

New test.prg

Code: Select all

#include "FiveWin.ch"
#include "xBrowse.ch"

function Test()

   local oDlg, oBrw, oBtn1, oBtn2, oRect
   local oBar
   Local nMINWidth  := 800//::cResTablet1
   Local nMINHeight := 600//::cResTablet2
   Local nMAXWidth := GETSYSMETRICS( 0 ) //risoluzione orizzontale
   Local nMAXHeight := GETSYSMETRICS( 1 ) //risoluzione verticale


   USE STATES  // use any DBF you have

   DEFINE FONT oFontMenuTablet NAME "TAHOMA" SIZE 0,-26

   DEFINE DIALOG oDlg SIZE nMINWidth,nMINHeight PIXEL TRUEPIXEL ;
   STYLE nOR( WS_OVERLAPPED,WS_THICKFRAME,WS_MAXIMIZEBOX,   0  ) FONT oFontMenuTablet ;
   TITLE "Selezione Turni"

   DEFINE BUTTONBAR  oBar SIZE 150,90 2013

   @ 130,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS NOBORDER  LINES

   oBrw:CreateFromCode()

   BrwBarBtns( oBar, oBrw, oDlg )

  * @ 350,500 BUTTON oBtn2 PROMPT "&Close" SIZE 80,30 PIXEL OF oDlg ACTION oDlg:End()

/*   oDlg:bResized := { || ;
      oRect          := oDlg:GetCliRect(), ;
      oBtn2:nTop     := oRect:nBottom - 50, ;
      oBtn2:nLeft    := oRect:nRight - 100   }
        */

      oDlg:aMinMaxInfo = { GETSYSMETRICS( 0 ), GETSYSMETRICS( 1 ),;  // xMaxSize,      yMaxSize
                                                              0,  0,;  // xMaxPosition,  yMaxPosition
                                             nMINWidth,  nMINHeight,;  // xMinTrackSize, yMinTrackSize
                                             nMAXWidth, nMAXHeight }







   ACTIVATE DIALOG oDlg CENTERED

   return nil

//------------------------------------------------------------------------------------//

     function BrwBarBtns( oBar, oBrw,oDlg )

       local n := 1

      DEFINE BUTTON OF oBar FILE ".\BITMAPS\page_up.ICO" PROMPT "Vai all'inizio" TOOLTIP "Vai all'inizio" ;
      ACTION ( oBrw:GoTop(), oBrw:SetFocus() )   GROUP

      DEFINE BUTTON OF oBar FILE ".\BITMAPS\page_down.ICO" PROMPT "Vai alla fine" TOOLTIP "Vai alla fine" ;
      ACTION ( oBrw:GoBottom(), oBrw:SetFocus() )   GROUP

       DEFINE BUTTON OF oBar FILE ".\BITMAPS\page_down.ICO" PROMPT "Cerca" TOOLTIP "Cerca" ;
      ACTION ( oBrw:GoBottom(), oBrw:SetFocus() )   GROUP

      DEFINE BUTTON OF oBar FILE ".\BITMAPS\SI.ICO" PROMPT "&Conferma" TOOLTIP "Conferma" ;
      ACTION (oDlg:End())     GROUP

      DEFINE BUTTON OF oBar FILE ".\BITMAPS\NO.ICO" PROMPT "&Annulla" TOOLTIP "Annulla" ;
      ACTION (oDlg:End())  GROUP

   return nil

 

Re: Help creating a Dialog for Tablet Windows

Posted: Tue Aug 15, 2017 7:47 pm
by Gale FORd
Here was a discussion of these issues.
http://forums.fivetechsupport.com/viewt ... ce#p183824

Another problem was the behavior differenance between Windows 10 on-screen keyboard and Windows 7 on-screen keyboard. Sometimes they cover part of the screen even when docked.

Re: Help creating a Dialog for Tablet Windows

Posted: Tue Aug 15, 2017 8:20 pm
by TimStone
First, find out the resolution of the tablet. There are many possibilities but use the one for your client's tablet.

You can try setting the resolution on your monitor to the same size. At least set the Main Window to that size.

Here is a major problem. You can get everything to fit, but when showing it on the tablet, even if you know the resolution, fields may be too small to read. Tablets allow for very little data to be displayed.

Re: Help creating a Dialog for Tablet Windows

Posted: Tue Aug 15, 2017 9:16 pm
by Gale FORd
I found a way to adjust Windows 10 on-screen keyboard size.
Keyboard is set to % of screen size. So if you set scaling to a bigger screen size in registry then in actuality it will make the keyboard smaller on tablet.
Here is nice setting I use for Panasonic 10" Toughpad tablets.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Scaling]
"MonitorSize"="16.0"

Re: Help creating a Dialog for Tablet Windows

Posted: Tue Aug 15, 2017 9:48 pm
by Gale FORd
I also like to use the standard keyboard so I have registry mod to turn on and select standard keyboard.

Code: Select all

function AddStandardKeyboard()
   local oReg, nError
   oReg := TReg32():New( HKEY_LOCAL_MACHINE, ;
      "Software\Microsoft\TabletTip\1.7", .f. )
   if oReg:nError == 0
      oReg:Set( "EnableCompatibilityKeyboard", 1 )
      oReg:Set( "KeyboardLayoutPreference", 2 )
   endif
   nError := oReg:nError
   if nError != 0
      msginfo( 'Could not set keyboard type in registry')
   endif
   oReg:close()

return nError
 

Re: Help creating a Dialog for Tablet Windows

Posted: Wed Aug 16, 2017 9:27 am
by Biel EA6DD
As we saw in Sillian, using Daniel's class tLayOut, we should not worry about screen resolution and controls size.

Code: Select all

#include "FiveWin.ch"
FUNCTION Main()
   LOCAL oWnd,cTitle,i,j,n
   LOCAL hLay:={=>},hFont:={=>}
   Local aBtnMenu     :=array(12)
   Local aBtnMenuImage:=array(12)
   Local aBtnMenuTitle:=array(12)
   cTitle:= "Test menu button Tablet"

   DEFINE FONT hFont["title"] NAME "TAHOMA" SIZE 0,-28
   DEFINE WINDOW oWnd FROM 0,0 TO 20,80 COLOR CLR_WHITE, CLR_BLUE //STYLE nOr( WS_POPUP, WS_VISIBLE ) //Uncommend if you don't want Window frame
   hLay["MAIN"]   := TLayout():new( oWnd )
   hLay["TOP"]    := hLay["MAIN"]:addVLayout(100) //Reserved on Top
   hLay["BDY"]    := hLay["MAIN"]:addVLayout()    //Body (Autoadjust)
   hLay["BTM"]    := hLay["MAIN"]:addVLayout(20)  //Reserved pixels on Bottom
   @  05, 69 SAY cTitle FONT hFont["title"] COLOR CLR_WHITE, CLR_BLUE OF hLay["TOP"] TRANSPARENT PIXEL

   //Creating Body LayOuts
   n:=0
   FOR i:=1 TO 3
      n++
      hLay[hb_ntos(i)]:=hLay["BDY"]:addVLayout()
      FOR j:=1 TO 4
         hLay[hb_ntos(i)+'.'+hb_ntos(j)]:=hLay[hb_ntos(i)]:addHLayout()
         @ 0,0 BTNBMP aBtnMenu[n] FILE aBtnMenuImage[n] ;
                   PROMPT aBtnMenuTitle[n] FLAT ;
                   PIXEL OF hLay[hb_ntos(i)+'.'+hb_ntos(j)] COLOR CLR_WHITE, RGB( 120,136,85 ) ACTION NIL
         hLay[hb_ntos(i)+'.'+hb_ntos(j)]:oClient:=aBtnMenu[n]
      NEXT
   NEXT
   ACTIVATE WINDOW oWnd MAXIMIZED
RETURN NIL

Re: Help creating a Dialog for Tablet Windows

Posted: Wed Aug 16, 2017 6:50 pm
by Silvio.Falconi
Right I remember
but then we must use allways tlayot class ?
for the edit dialog ?

Re: Help creating a Dialog for Tablet Windows

Posted: Sat Aug 19, 2017 5:49 pm
by nageswaragunupudi
Whether desktop or tablet, we need to design all our screens suitable to any resolution and orientation.

Please try this small sample:

Code: Select all

#include "fivewin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, aBtn[ 12 ], cBmpPath, aBmp
   local n

   cBmpPath    := "c:\fwh\bitmaps\32x32\"
   aBmp        := DIRECTORY( cBmpPath + "*.bmp" )

   DEFINE DIALOG oDlg SIZE Int( ScreenWidth() * 0.85 ), Int( ScreenHeight() * 0.85) PIXEL TRUEPIXEL

   for n := 1 to 12
      @ 40, 40 BTNBMP aBtn[ n ] PROMPT NTOCMONTH(  n ) ;
         FILE cBmpPath + aBmp[ n, 1 ] ;
         SIZE 100,50 PIXEL OF oDlg 2007 ;
         ACTION BtnAction( Self )
      aBtn[ n ]:Cargo := n
   next

   oDlg:bOnDisplayChange   := { || DlgResize( oDlg, aBtn ) }

   ACTIVATE DIALOG oDlg CENTERED ON INIT DlgResize( oDlg, aBtn )

return nil

//----------------------------------------------------------------------------//

function DlgResize( oDlg, aBtn )

   local i, j, n, r, c, w, h

   WITH OBJECT oDlg
      :nWidth     := Int( ScreenWidth()  * 0.85 )
      :nHeight    := Int( ScreenHeight() * 0.85 )

      w           := ( :nWidth  - 60 ) / 4
      h           := ( :nHeight - 80 ) / 3

   END

   r     := 20
   n     := 1
   for i := 1 to 3
      c     := 20
      for j := 1 to 4
         WITH OBJECT aBtn[ n ]
            :nTop    := r
            :nLeft   := c
            :nWidth  := w - 10
            :nHeight := h - 10
         END
         n++
         c     += w
      next j
      r  += h
   next i

   oDlg:Center()
   oDlg:Refresh()

return nil

//----------------------------------------------------------------------------//

function BtnAction( oBtn )

   msginfo( oBtn:Cargo )

return nil

//----------------------------------------------------------------------------//
Please note the usage of bOnDisplayChange.

Re: Help creating a Dialog for Tablet Windows

Posted: Sat Aug 19, 2017 6:43 pm
by Silvio.Falconi
perhaps there is an error

Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... } length: 0
[ 2] = N 1

Re: Help creating a Dialog for Tablet Windows

Posted: Sat Aug 19, 2017 6:45 pm
by Silvio.Falconi
no sorry my mistake

Re: Help creating a Dialog for Tablet Windows

Posted: Sat Aug 19, 2017 6:47 pm
by nageswaragunupudi
Please check these lines and give correct path

cBmpPath := "c:\fwh\bitmaps\32x32\" // give your path
aBmp := DIRECTORY( cBmpPath + "*.bmp" )

Re: Help creating a Dialog for Tablet Windows

Posted: Sat Aug 19, 2017 7:43 pm
by Silvio.Falconi
yes yes I found the error
I use c:\work\fwh...