FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse edit dialog and navigation
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: xBrowse edit dialog and navigation
Posted: Sun Jun 02, 2019 02:35 AM

This original post was about edits with a browse. I was responding to that post with a method I use to make editing of a browse list easier and faster. It's a concept my clients really appreciate. I really don't see how that relates to your question following it. I was strictly addressing the question of edit controls and a faster means of moving through a lot of data. It has absolutely no relationship to the database ( though I do use tdatabase / tdata / trecord ) since I built the same concept back with Clipper and DOS ... and in fact, it probably dates all the way back to dBase II ...

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
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 03, 2019 07:54 AM

Mr Rao

Thanks for the demo program,yes that is what I was after

On a GET I tried using VAR oRec:Fieldget() but I get a "invalid value" compiler error

I tried using field number and field name as a parameter

Yet this method works ok for MSGINFO(orec:fieldget(2)) or MSGINFO(orec:fieldget("FIRST"))

Not a problem as I will use oRec:adata[nFieldNumber][2]

Thanks
Peter

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 03, 2019 09:08 AM

They are not safe.

Please use oRec:fieldname

When we made this class this is how we expect the usage to be.

Regards



G. N. Rao.

Hyderabad, India
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 03, 2019 10:12 AM

Hi Tim,

The screen design is good specially the Icon's on the Title bars. May I ask you to provide the code ( Just Toolbar ) along with Icons ? Thanks in advance...!

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 03, 2019 01:46 PM

Mr Rao

When when adding a new record in a lot of cases the blank fields will need to be auto filled
with data from the previous edit dialog.So I was going to make a copy of oRec:Data and on the
new blank record overwrite the current oRec:aData and oRec:aOrg with data from the copy.

Is there a better way of doing this ?

Regards
Peter

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 03, 2019 08:35 PM
All of my coding uses an .RC file for screens. The bar is standard FWH.

Control in .rc file:
Code (fw): Select all Collapse
    CONTROL                 "", 100, "TBar", 0|WS_CHILD|WS_VISIBLE, 0,0, 660, 30


Code for the button bar:
Code (fw): Select all Collapse
   // Define the button bar
   REDEFINE BUTTONBAR oBarInv ID 100 SIZE 60,55 OF oDiw 2015
          oBarInv:bClrGrad := aPubGrad

   DEFINE BUTTON oBtn1 OF oBarInv RESOURCE "HRADD" PROMPT "Add" TOOLTIP "Add a new part record"  ;
      ACTION ( oLbxin:gobottom(), ::oInventory:AddNewPart(), oLbxin:refresh( ),;
       ::oPart:load(), oDiw:update( ), oNum:setfocus( ) ) GROUP LABEL "Parts" 

   DEFINE BUTTON oBtn2 OF oBarInv RESOURCE "HRSAVE" PROMPT "Save" TOOLTIP "Save this record" ;
      ACTION ( ::oPart:save( ), oLbxin:refresh(), oDiw:update( ), oLbxin:setfocus( ), oLbxin:skip(0) )

   DEFINE BUTTON oBtn4 OF oBarInv RESOURCE "HRDELETE" PROMPT "Delete" TOOLTIP "Delete the selected part";
      ACTION ( ::oInventory:DeletePart( ), oLbxin:skip(1), ::oPart:load(), oDiw:update(), oLbxin:setfocus( ) ) ;

//. Add in more buttons here
//

     DEFINE BUTTON oBtn0 OF oBarInv RESOURCE "HRHELP" PROMPT "Help" TOOLTIP "OnLine Manual" ;
        ACTION WinExec( "hh asw10.chm" ) GROUP BTNRIGHT

     DEFINE BUTTON oBtn7 OF oBarInv RESOURCE "HREXIT" PROMPT "Exit" TOOLTIP "Exit inventory" ;
       ACTION ( oDiw:end( ), ::oInventory:end( ) ) BTNRIGHT


You can also define the menus for buttons ... and it all works quite smoothly. You will notice that I'm using data objects. I use tData / tRecord. The browse references the file as a tData object. A tRecord object is created, and each time a new record is highlighted, the :load() places the values of that record into that object. The gets all reference the tRecord object. It is very smooth.

You can add as many buttons as you wish

The icons are all created inhouse for this application, and are proprietary so I can't post them. However, I use Axialis Icon Workshop to create them, and save them as .bmp files ( 32x32 ) then include them all in the .rc file.
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 03, 2019 11:52 PM
reds wrote:Mr Rao

When when adding a new record in a lot of cases the blank fields will need to be auto filled
with data from the previous edit dialog.So I was going to make a copy of oRec:Data and on the
new blank record overwrite the current oRec:aData and oRec:aOrg with data from the copy.

Is there a better way of doing this ?

Regards
Peter


For prefilling data you may consider the methods:
1) oRec:Copy() and oRec:Paste()
2) oRec:CopyFrom( oOtherRec )
3) oRec:SetDefault( cField, uValue, [lCanModify] )
or
oRec:SetDefault( { { field, value},....} )
SetDefaut values are used only when appending

For example, you can try this:
Code (fw): Select all Collapse
   @ 200,160 BTNBMP oBtn RESOURCE FWBitmap( "new16" )   SIZE 32,32 PIXEL OF oDlg FLAT TOOLTIP "New"  ;
            WHEN !Empty( oRec:RecNo ) ACTION ( oRec:Copy(),oRec:Load( .t. ),oRec:Paste(), oDlg:Update() )
Regards



G. N. Rao.

Hyderabad, India
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: xBrowse edit dialog and navigation
Posted: Wed Jun 05, 2019 11:53 AM
Thanks for that I will take a look at these

On your example code I want to replace the checkbox and show a bitmap file as below but it never changes from the intial setting.

Also I would like to use the toggle switch (green for on) bitmap that is used in the browser default edit dialog,where
is this located.

Thanks
Peter


Code (fw): Select all Collapse
  @ 100,190  BTNBMP  NOBORDER OF oDlg  SIZE 30,15;
               FILE  IIF( oRec:MARRIED, "..\bitmaps\on.bmp", "..\bitmaps\off.bmp"  )     ;
                         ACTION ( oRec:MARRIED := ! oRec:MARRIED, ;
                             ::SetImages( IIF( oRec:MARRIED, "..\bitmaps\on.bmp", "..\bitmaps\off.bmp"  ) )  ) UPDATE
     //  @ 100,200 CHECKBOX oRec:Married PROMPT "" SIZE 26,26 PIXEL OF oDlg UPDATE
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse edit dialog and navigation
Posted: Wed Jun 05, 2019 12:48 PM
Also I would like to use the toggle switch (green for on) bitmap that is used in the browser default edit dialog,where
is this located.


That is not a bitmap. It is a control, SWITCH control. Please see fivewin.ch for usage.

In the example, I posted above, instead of checkbox, use this code:
Code (fw): Select all Collapse
   @ 103,180 SWITCH oRec:Married SIZE 40,18 PIXEL OF oDlg UPDATE OVALSTYLE BORDERSIZE 1 THUMBSIZE 1


Regards



G. N. Rao.

Hyderabad, India
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: xBrowse edit dialog and navigation
Posted: Wed Jun 05, 2019 03:40 PM

Any idea why the bitmap doesn't refresh with new value

Thanks for Switch info,though doesn't appear to be setup to run with a resource file

Regards
Peter

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse edit dialog and navigation
Posted: Thu Jun 06, 2019 12:31 AM
Please try this:
Code (fw): Select all Collapse
   @ 100,190 BTNBMP oBtn ;
      FILE "c:\fwh\bitmaps\on.bmp", nil, "c:\fwh\bitmaps\off.bmp" ;
      SIZE 26,26 PIXEL OF oDlg CENTER NOBORDER UPDATE ;
      ACTION ( oRec:Married := !oRec:Married, ::Refresh() )
   oBtn:bBmpNo := { || If( oRec:Married, 1, 3 ) }
Regards



G. N. Rao.

Hyderabad, India
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: xBrowse edit dialog and navigation
Posted: Mon Jun 17, 2019 05:45 PM

Belated thanks,now working fine
Regards
Peter

Continue the discussion