MiniGUI DBU

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
gfilatov
Posts: 570
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 14 times
Been thanked: 136 times
Contact:

MiniGUI DBU

Post by gfilatov » Fri Nov 02, 2018 7:27 pm

Hi Friends,

I've found a nice utility EMAG Software DBU by Enrico Giordano on Inet.

It was built with FiveWin library and xHarbour compiler.

This DBF Manager works very well but it have an Italian interface only.

The author didn't promise the other localization on the FiveWin forum.

Is it a problem :?:

But we have already the power MiniGUI tool :!:

My humble effort is below. There are the dummy tool buttons and menu actions now.

But it is have a basic TBROWSE features IMHO.

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
 * Copyright 2018 Grigory Filatov <gfilatov@inbox.ru>
 *
 * Inspired by EMAG Software DBU https://www.emagsoftware.it
*/

REQUEST DBFCDX

#include "minigui.ch"
#include "tsbrowse.ch" 
#include "dbinfo.ch"

#command INSERT [<b4: BEFORE>] => dbInsert( <.b4.> )

#xtranslate IsMaximized ( <hWnd> ) => IsZoomed ( <hWnd> )

#define PRG_TITLE 'MiniGUI DBU Template'

Static BRW_1
Static cIni

SET PROCEDURE TO dbInsert

Procedure Main( cDBFName )

  Local lMaximized, nTop, nLeft, nWidth, nHeight
  Local cFile, nW, nH

  SET CENTURY ON
  SET DATE BRITISH

  SET EXCLUSIVE ON

  SET AUTOSCROLL OFF

  SET FONT TO "Tahoma", 9

  SET DEFAULT ICON TO "ICONA"

  DEFAULT cDBFName := "test"

  IF EMPTY( File( cFileNoExt( cDBFName ) + ".fpt" ) )
    rddSetDefault( "DBFNTX" )
  ELSE
    rddSetDefault( "DBFCDX" )
  ENDIF

  USE ( GetStartupFolder() + "\" + cDBFName )

  cFile := dbInfo( DBI_FULLPATH )

  cIni := ChangeFileExt( Application.ExeName, '.ini' )

  BEGIN INI FILENAME (cIni)
	GET lMaximized SECTION "Parameters" ENTRY "Maximized" DEFAULT .T.
	GET nTop SECTION "Parameters" ENTRY "Top" DEFAULT 0
	GET nLeft SECTION "Parameters" ENTRY "Left" DEFAULT 0
	GET nWidth SECTION "Parameters" ENTRY "Width" DEFAULT 0
	GET nHeight SECTION "Parameters" ENTRY "Height" DEFAULT 0
  END INI

  DEFINE WINDOW MainWin ;
         MAIN ;
         TITLE PRG_TITLE ;
         ON MAXIMIZE Browse_OnSize() ;
         ON SIZE Browse_OnSize() ;
         ON RELEASE SaveMRUFileList()

         IF !lMaximized
           IF nTop >= 0
             MainWin.Row := nTop
           ENDIF
           IF nLeft >= 0
             MainWin.Col := nLeft
           ENDIF
           IF nWidth > 0
             MainWin.Width := nWidth
           ENDIF
           IF nHeight > 0
             MainWin.Height := nHeight
           ENDIF
         ENDIF

         CreateMainMenu()

         CreateToolBar()

         DEFINE STATUSBAR KEYBOARD
         END STATUSBAR

         IF lMaximized
           nW := GetDesktopWidth()
           nH := MainWin.ClientHeight - GetToolBarHeight() - GetTitleHeight() + iif( IsThemed(), GetBorderHeight() + 2, 2 * GetBorderHeight() )
         ELSE
           nW := MainWin.ClientWidth + GetBorderWidth()
           nH := MainWin.ClientHeight - GetToolBarHeight() - GetTitleHeight() - GetBorderHeight() / 2 - 2
         ENDIF

         CreateBrowse( GetToolBarHeight() + GetBorderHeight() / 2, 0, nW, nH )

         SetHotKeys()

  END WINDOW

  AddMRUItem( cFile, Nil )

  MainWin.Title := PRG_TITLE + " - " + cFile

  IF lMaximized
    MAXIMIZE WINDOW MainWin
  ENDIF
  ACTIVATE WINDOW MainWin

Return

****** End of Main ******


Static Procedure SetHotKeys()

  // <INSERT> key processing
  ON KEY INSERT ACTION { || AddRecord() }

  ON KEY F2 ACTION _dummy()

  ON KEY F3 ACTION _dummy()

  ON KEY F4 ACTION _dummy()

  ON KEY F5 ACTION { || Browse_Refresh() }

  ON KEY F6 ACTION _dummy()

  ON KEY F7 ACTION _dummy()

  ON KEY F8 ACTION _dummy()

  ON KEY F9 ACTION _dummy()

  ON KEY F11 ACTION Browse_GotoFirstCol()

  ON KEY F12 ACTION Browse_GotoLastCol()

  ON KEY CONTROL+D ACTION DuplicateRec()

  ON KEY CONTROL+I ACTION _dummy()

  ON KEY CONTROL+R ACTION _dummy()

  ON KEY CONTROL+T ACTION _dummy()

  ON KEY CONTROL+X ACTION { || QuickExit() }

Return

....
Your feedback is welcome :idea:
Attachments
mgDbu.zip
(926.41 KiB) Downloaded 81 times
sshot.jpg
sshot.jpg (231.07 KiB) Viewed 490 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
serge_girard
Posts: 2139
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 449 times
Been thanked: 102 times
Contact:

Post by serge_girard » Sat Nov 03, 2018 8:00 am

Thanks Grigory!

Serge

User avatar
serge_girard
Posts: 2139
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 449 times
Been thanked: 102 times
Contact:

Post by serge_girard » Sat Nov 03, 2018 8:56 am

Great stuff! Can't wait to see dummy function working!

Serge

User avatar
mol
Posts: 3062
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 176 times
Been thanked: 96 times
Contact:

Post by mol » Sat Nov 03, 2018 11:23 am

Thanks!

User avatar
Steed
Posts: 365
Joined: Sat Dec 12, 2009 3:40 pm
Has thanked: 1 time
Been thanked: 2 times

Post by Steed » Tue Nov 06, 2018 6:21 pm

Thanks

edk
Posts: 360
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 102 times
Been thanked: 262 times

Post by edk » Wed Nov 07, 2018 3:13 pm

Hello Grigory.
I noticed the strange behavior of TSBROWSE.
If I press and hold down the "cursor down" key and scroll the records, then after reaching the last visible record, the next displayed rows take its value, not the values of physical records.
Bez tytułu.png
Bez tytułu.png (122.29 KiB) Viewed 292 times

User avatar
gfilatov
Posts: 570
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 14 times
Been thanked: 136 times
Contact:

Post by gfilatov » Wed Nov 07, 2018 7:36 pm

edk wrote:
Wed Nov 07, 2018 3:13 pm
Hello Grigory.
I noticed the strange behavior of TSBROWSE.
If I press and hold down the "cursor down" key and scroll the records, then after reaching the last visible record, the next displayed rows take its value, not the values of physical records.
Hello Edward,

Thanks for yor feedback!

I know that TSBROWSE is not perfect. But it is a best browser for the Minigui now.
Please be so kind to review the updated attached application with the last improvements.

BTW I can not reproduce above wrong behavior in this version 0.64 ;)
Attachments
MGDBU064.zip
Last beta of mgDBU
(943.12 KiB) Downloaded 35 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

edk
Posts: 360
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 102 times
Been thanked: 262 times

Post by edk » Wed Nov 07, 2018 9:01 pm

Hi again Grigory.
gfilatov wrote:
Wed Nov 07, 2018 7:36 pm
Please be so kind to review the updated attached application with the last improvements.

BTW I can not reproduce above wrong behavior in this version 0.64 ;)
It's looks pretty good. Like old, good Clipper TBrowse class. I like it.
Я думаю, що мені доведеться ближче подивитися на MiniGUI EE, але мені все ще бракує часу.

Edward.

User avatar
mol
Posts: 3062
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 176 times
Been thanked: 96 times
Contact:

Post by mol » Wed Nov 07, 2018 11:00 pm

Is it the way to adapt TSBrowse to use with official HMG?

edk
Posts: 360
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 102 times
Been thanked: 262 times

Post by edk » Thu Nov 08, 2018 8:13 am

Hi again.
gfilatov wrote:
Wed Nov 07, 2018 7:36 pm
Please be so kind to review the updated attached application with the last improvements.

BTW I can not reproduce above wrong behavior in this version 0.64 ;)
Small Errat.
It works fine on my home computer, at work: on some computers it's OK, and others are not. I was looking for differences, I compared the OS version, environment settings. In the end I came to the fact that the reason is the resolution of the screen.

I made the test on one computer (Win10 v.1803, 64-bit) and here are the results:

It's correct for resolutions:
1152 x 864
1280 x 600
1280 x 720
1280 x 800
1280 x 960
1280 x 1024
1440 x 1050
1440 x 900
1600 x 900
1680 x 1050
1920 x 1080

Incorrectly at resolutions:
1024 x 768
1280 x 768
1360 x 768
1366 x 768

As you can see, it is incorrect when the screen height is set to 768 pixels.

Regards, Edward.

Post Reply