Help creating a Dialog for Tablet Windows

Help creating a Dialog for Tablet Windows

Postby Silvio.Falconi » Mon Aug 14, 2017 6:13 pm

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  Expand view  RUN
Function Main(cPar1,cpar2)


Or

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

Code: Select all  Expand view  RUN
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  Expand view  RUN

#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


 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help creating a Dialog for Tablet Windows

Postby hmpaquito » Mon Aug 14, 2017 8:18 pm

Perhaps oDlg:bResized is used when dialog is resized clicking corner or lateral or maximized.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Help creating a Dialog for Tablet Windows

Postby Gale FORd » Mon Aug 14, 2017 10:05 pm

Don't forget Portrait vs Landscape orientation.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Help creating a Dialog for Tablet Windows

Postby Silvio.Falconi » Tue Aug 15, 2017 7:01 pm

Gale FORd wrote:Don't forget Portrait vs Landscape orientation.


How make it ?

New test.prg
Code: Select all  Expand view  RUN
#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

 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help creating a Dialog for Tablet Windows

Postby Gale FORd » Tue Aug 15, 2017 7:47 pm

Here was a discussion of these issues.
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=21691&p=183824&hilit=surface#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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Help creating a Dialog for Tablet Windows

Postby TimStone » Tue Aug 15, 2017 8:20 pm

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.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Help creating a Dialog for Tablet Windows

Postby Gale FORd » Tue Aug 15, 2017 9:16 pm

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"
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Help creating a Dialog for Tablet Windows

Postby Gale FORd » Tue Aug 15, 2017 9:48 pm

I also like to use the standard keyboard so I have registry mod to turn on and select standard keyboard.
Code: Select all  Expand view  RUN

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
 
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Help creating a Dialog for Tablet Windows

Postby Biel EA6DD » Wed Aug 16, 2017 9:27 am

As we saw in Sillian, using Daniel's class tLayOut, we should not worry about screen resolution and controls size.
Code: Select all  Expand view  RUN

#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
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
User avatar
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Re: Help creating a Dialog for Tablet Windows

Postby Silvio.Falconi » Wed Aug 16, 2017 6:50 pm

Right I remember
but then we must use allways tlayot class ?
for the edit dialog ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help creating a Dialog for Tablet Windows

Postby nageswaragunupudi » Sat Aug 19, 2017 5:49 pm

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  Expand view  RUN
#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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Help creating a Dialog for Tablet Windows

Postby Silvio.Falconi » Sat Aug 19, 2017 6:43 pm

perhaps there is an error

Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... } length: 0
[ 2] = N 1
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help creating a Dialog for Tablet Windows

Postby Silvio.Falconi » Sat Aug 19, 2017 6:45 pm

no sorry my mistake
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Help creating a Dialog for Tablet Windows

Postby nageswaragunupudi » Sat Aug 19, 2017 6:47 pm

Please check these lines and give correct path

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Help creating a Dialog for Tablet Windows

Postby Silvio.Falconi » Sat Aug 19, 2017 7:43 pm

yes yes I found the error
I use c:\work\fwh...
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 21 guests

cron