15.10 Browse problem

15.10 Browse problem

Postby TimStone » Thu Dec 24, 2015 9:25 pm

Starting with 15.10, using a Resource file, the following code no longer displays properly:

add to oLbxcl header "Account" data oClients:acrnum ALIGN LEFT ORDER "eclnum"
add to oLbxcl Header "Client" data oClients:clicom ALIGN LEFT ORDER "eclcom"
add to oLbxcl header "City" data oClients:clicty ALIGN LEFT
add to oLbxcl Header "Phone" data oClients:clipho ALIGN LEFT ORDER "eclpho"
add to oLbxcl Header "Email" data oClients:clieml ALIGN LEFT

In the past, the columns always auto sized depeneding on the size of the data fields. Now the first column takes up the first 80% of the browse, and the remainder are scqueezed into the remaining space equally.

Prior to 15.10 this was working correctly. Now I would have to go to every xbrowse and manually set the size for each column.

Built with xHarbour ( .com ) latest release. This is used to maintain an older version of our main program.
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby Antonio Linares » Fri Dec 25, 2015 8:10 am

Tim,

Surely Rao will help you on this
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: 15.10 Browse problem

Postby nageswaragunupudi » Fri Dec 25, 2015 9:30 am

Mr Tim

I can not see any modification to xbrowse that could have this effect. Nor I have seen any such change in any browse recently.

Can you please send me to my email
1) the dbf file with some sample records
2) exact program code relating to this browse
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Tue Dec 29, 2015 5:10 pm

Good Morning,

Here is an example. The W setting is for widescreen monitors ( 1920 x 1080 ) and the other is the older VGA setting:

Code: Select all  Expand view  RUN

    IF cWSshow = "W"
        add to oLbvm header sLbl[1] data oUnt:vehlic ALIGN LEFT ORDER "evelic" SIZE 180
        add to oLbvm Header "Client" data oUnt:clicom ALIGN LEFT ORDER "evecom" SIZE 300
        add to oLbvm Header "Account" data oUnt:acrnum ALIGN CENTER ORDER "evenum" SIZE 130
        add to oLbvm Header sLbl[2] data oUnt:vehidn ALIGN LEFT ORDER "eveidn" SIZE 300
        add to oLbvm Header "Year" data oUnt:vehyer ALIGN CENTER SIZE 80
        add to oLbvm header "Make" data oUnt:vehmak ALIGN LEFT ORDER "evemod" SIZE 250
        add to oLbvm Header "Model" data oUnt:vehmod ALIGN LEFT SIZE 250
        add to oLbvm Header "SubModel" data oUnt:vehsmd ALIGN LEFT SIZE 250
  ELSE
                add to oLbvm header sLbl[1] data oUnt:vehlic ALIGN LEFT ORDER "evelic"  
        add to oLbvm Header "Client" data oUnt:clicom ALIGN LEFT ORDER "evecom"
        add to oLbvm Header sLbl[2] data oUnt:vehidn ALIGN LEFT ORDER "eveidn"  
        add to oLbvm Header "Year" data oUnt:vehyer ALIGN LEFT
        add to oLbvm header "Make" data oUnt:vehmak ALIGN LEFT ORDER "evemod"
        add to oLbvm Header "Model" data oUnt:vehmod ALIGN LEFT
  ENDIF

 


This is using xHarbour ( .com ) and if I do the build with FWH 15.10, there is no auto spacing of columns on the lower section ( where SIZE is not set ). If I build it with FWH 15.06, it is fine. I have not tried later additions, but the change comes in somewhere between 15.06 and 15.10.

Tim
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Wed Dec 30, 2015 3:00 am

I tried to reproduce the problem at my end. In the absence of dbf, I created a dummy dbf with some adhoc structure. Used TDatabase and exactly your syntax to create the columns.

My test program:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

static oUnt

function Main()

   OpenDBF()
   BrowseData()

return nil

static function OpenDbf

   CreateDBF()

   oUnt  := TDataBase():New( nil, "UNT.DBF", "DBFCDX", .t. )
   oUnt:Use()

return nil

static function CreateDBF()

   local n
   local aCols := { ;
   { "VEHLIC",  "C", 10, 0 }, ;
   { "CLICOM",  "C", 25, 0 }, ;
   { "ACRNUM",  "C", 10, 0 }, ;
   { "VEHIDN",  "C", 10, 0 }, ;
   { "VEHYER",  "C",  4, 0 }, ;
   { "VEHMAK",  "C", 10, 0 }, ;
   { "VEHMOD",  "C", 10, 0 }, ;
   { "VEHSMD",  "C", 10, 0 }  }

   DBCREATE( "UNT.DBF", aCols, "DBFCDX", .T., "UNT" )
   APPEND BLANK
   for n := 1 to Len( aCols )
      FieldPut( n, Replicate( Chr( n + 64 ), FieldLen( n ) ) )
   next
   CLOSE UNT

return nil

static function BrowseData()

   local oDlg, oLbvm, sLbl[2]
   local cWSShow := 'S'

   sLbl[ 1 ] := "Lab-1"
   sLbl[ 2 ] := "Lab-2"

   DEFINE DIALOG oDlg SIZE 700,200 PIXEL TITLE FWVERSION

   @ 10,10 XBROWSE oLbvm SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE oUnt CELL LINES NOBORDER

   IF cWSshow = "W"
        add to oLbvm header sLbl[1] data oUnt:vehlic ALIGN LEFT ORDER "evelic" SIZE 180
        add to oLbvm Header "Client" data oUnt:clicom ALIGN LEFT ORDER "evecom" SIZE 300
        add to oLbvm Header "Account" data oUnt:acrnum ALIGN CENTER ORDER "evenum" SIZE 130
        add to oLbvm Header sLbl[2] data oUnt:vehidn ALIGN LEFT ORDER "eveidn" SIZE 300
        add to oLbvm Header "Year" data oUnt:vehyer ALIGN CENTER SIZE 80
        add to oLbvm header "Make" data oUnt:vehmak ALIGN LEFT ORDER "evemod" SIZE 250
        add to oLbvm Header "Model" data oUnt:vehmod ALIGN LEFT SIZE 250
        add to oLbvm Header "SubModel" data oUnt:vehsmd ALIGN LEFT SIZE 250
   ELSE
        add to oLbvm header sLbl[1] data oUnt:vehlic ALIGN LEFT ORDER "evelic"
        add to oLbvm Header "Client" data oUnt:clicom ALIGN LEFT ORDER "evecom"
        add to oLbvm Header sLbl[2] data oUnt:vehidn ALIGN LEFT ORDER "eveidn"
        add to oLbvm Header "Year" data oUnt:vehyer ALIGN LEFT
        add to oLbvm header "Make" data oUnt:vehmak ALIGN LEFT ORDER "evemod"
        add to oLbvm Header "Model" data oUnt:vehmod ALIGN LEFT
   ENDIF

   oLbvm:CreateFromCode()
   ACTIVATE DIALOG oDlg CENTERED

return nil
 


Result:
Image

I do not see any problem.
Can you help me to recreate the problem?
Probably it has something to do with the code after all "add columns" and before oLbvm:CreateFromCode().
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Wed Dec 30, 2015 3:42 am

Here is a better sample:

Code: Select all  Expand view  RUN

    // Create the dialog  to get type of workorder, search type , browse list
    DEFINE DIALOG oDpw0 BRUSH oBrush TRANSPARENT RESOURCE "PRO100r" OF oWdlg FONT oMFont
    // Create radio controls
    REDEFINE RADIO aRadio[1] VAR aRadOpts[1] ID 417, 418, 419 OF oDpw0 ON CLICK oLbwlu:setfocus( )
    REDEFINE RADIO aRadio[2] VAR aRadOpts[2] ID 427, 429, 430 OF oDpw0 ;
        ON CLICK ( IIF( aRadOpts[2] = 3,  oUnt:setOrder("evecom") , oUnt:setOrder("evelic") ), oUnt:gotop(), oLbwlu:setfocus( ) )
    // Create button control
    REDEFINE BTNBMP RESOURCE "HROK" ID 416 OF oDpw0 TOOLTIP "Create workorder" PROMPT "Accept" ;
        ACTION oDpw0:end() NOBORDER TRANSPARENT
    REDEFINE BTNBMP RESOURCE "APPT" ID 415 OF oDpw0 TOOLTIP "Create from an appointment" PROMPT "Appointment" ;
        ACTION ( aAppt := ShowAppts( aAppt ), lByAppt := .T. , oDpw0:end() ) NOBORDER TRANSPARENT

    // Create the browse
    REDEFINE XBROWSE oLbwlu ID 440 OF oDpw0
    // Attach the database
    oLbwlu:setoDBF( oUnt )
    // Add the columns
    add to oLbwlu Header "Client" data oUnt:clicom ALIGN LEFT
    add to oLbwlu header  sLbl[4] data oUnt:VehLic ALIGN LEFT
    add to oLbwlu Header "Year" data oUnt:VehYer ALIGN LEFT
    add to oLbwlu Header "Make" data oUnt:VehMak ALIGN LEFT
    add to oLbwlu Header "Model" data oUnt:VehMod ALIGN LEFT

    // Provide the header gradient
    oLbwlu:bClrGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
        { 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
    // Set the header and row heights
    oLbwlu:nHeaderHeight := 30
    oLbwlu:nRowHeight := 24
    oLbwlu:nStretchCol := STRETCHCOL_WIDEST

    // Turn off horizontal scrolling
    oLbwlu:lHScroll := .F.
    // Set the styles
    oLbwlu:nMarqueeStyle := MARQSTYLE_HIGHLROW
    oLbwlu:nColDividerStyle := LINESTYLE_RAISED
    oLbwlu:nRowDividerStyle := LINESTYLE_RAISED
    // Use for incremental search on opened database
    oLbwlu:bSeek := { |c| oUnt:Seek( Upper( c )) }
    FOR nCCol := 1 TO LEN( oLbwlu:acols )
        oLbwlu:aCols[nCCol]:nHeadStrAlign  := AL_CENTER
    NEXT

    // Activate dialog
    ACTIVATE DIALOG oDpw0 ON PAINT oLbwlu:setfocus( ) ON INIT oDpw0:center(wndmain())

 


And here is the .RC

Code: Select all  Expand view  RUN

PRO100R DIALOG DISCARDABLE 0, 0, 650, 245
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "Start Workorder"
FONT 8, "Arial"
BEGIN
  CONTROL "", 440, "TXBROWSE", WS_TABSTOP|0x00a00000, 10, 40, 630, 130
  CONTROL "Estimate", 417, "Button", BS_RADIOBUTTON, 10, 6, 60, 10
  CONTROL "Invoice", 418, "Button", BS_RADIOBUTTON, 80, 6, 60, 10
  CONTROL "Counter Sale", 419, "Button", BS_RADIOBUTTON, 150, 6, 60, 10
  CONTROL "Cash Sale", 427, "Button", BS_RADIOBUTTON, 10, 20, 60, 10
  CONTROL "Search by License", 429, "Button", BS_RADIOBUTTON, 150, 20, 100, 10
  CONTROL "Search by Client", 430, "Button", BS_RADIOBUTTON, 260, 20, 100, 10
  CONTROL "", 416, "Button", WS_TABSTOP, 195, 175, 60, 60
  CONTROL "", 415, "Button", WS_TABSTOP, 245, 175, 60, 60
END

 


And the .dbf structure:

Code: Select all  Expand view  RUN

VEHLIC  C  12  0        License
VEHYER  C   4  0        Model year
VEHMAK  C  25  0        Make
VEHMOD  C  25  0        Model
CLICOM  C  25  0        Client name
 


As I indicated, it has worked perfectly for years, up through ( and including ) 15.06.

Tim
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Wed Dec 30, 2015 6:56 am

Even this is working well for me.
bcc + xharbour
Image

This is the code:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

static oUnt

function Main()

   OpenDBF()
   BrowseData()

return nil

static function OpenDbf

   CreateDBF()

   oUnt  := TDataBase():New( nil, "UNT.DBF", "DBFCDX", .t. )
   oUnt:Use()

return nil

static function CreateDBF()

   local n
   local aCols := { ;
   { "VEHLIC",  "C", 12, 0 }, ;
   { "CLICOM",  "C", 25, 0 }, ;
   { "ACRNUM",  "C", 10, 0 }, ;
   { "VEHIDN",  "C", 10, 0 }, ;
   { "VEHYER",  "C",  4, 0 }, ;
   { "VEHMAK",  "C", 25, 0 }, ;
   { "VEHMOD",  "C", 25, 0 }, ;
   { "VEHSMD",  "C", 25, 0 }  }

   DBCREATE( "UNT.DBF", aCols, "DBFCDX", .T., "UNT" )
   APPEND BLANK
   for n := 1 to Len( aCols )
      FieldPut( n, Replicate( Chr( n + 64 ), FieldLen( n ) ) )
   next
   CLOSE UNT

return nil


static function BrowseData()

   local oDpw0, oLbwlu
   local aRadio[2]
   local aRadOpts := { 1, 1 }
   local oBrush, oMFont,nccol
   local slbl := { "lab-1", "lab-2", "lab-3", "lab-4" }


   DEFINE FONT oMfont NAME "TAHOMA" SIZE 0,-10
   DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\stone.bmp"

    // Create the dialog  to get type of workorder, search type , browse list
    DEFINE DIALOG oDpw0 BRUSH oBrush TRANSPARENT RESOURCE "PRO100r" /* OF oWdlg */ FONT oMFont
    // Create radio controls
    REDEFINE RADIO aRadio[1] VAR aRadOpts[1] ID 417, 418, 419 OF oDpw0 ON CLICK oLbwlu:setfocus( )
    REDEFINE RADIO aRadio[2] VAR aRadOpts[2] ID 427, 429, 430 OF oDpw0 ;
        ON CLICK ( IIF( aRadOpts[2] = 3,  oUnt:setOrder("evecom") , oUnt:setOrder("evelic") ), oUnt:gotop(), oLbwlu:setfocus( ) )
    // Create button control
    REDEFINE BTNBMP RESOURCE "HROK" ID 416 OF oDpw0 TOOLTIP "Create workorder" PROMPT "Accept" ;
        ACTION oDpw0:end() NOBORDER TRANSPARENT
    REDEFINE BTNBMP RESOURCE "APPT" ID 415 OF oDpw0 TOOLTIP "Create from an appointment" PROMPT "Appointment" ;
        ACTION ( /*aAppt := ShowAppts( aAppt ), lByAppt := .T. , */ oDpw0:end() ) NOBORDER TRANSPARENT

    // Create the browse
    REDEFINE XBROWSE oLbwlu ID 440 OF oDpw0
    // Attach the database
    oLbwlu:setoDBF( oUnt )
    // Add the columns
    add to oLbwlu Header "Client" data oUnt:clicom ALIGN LEFT
    add to oLbwlu header  sLbl[4] data oUnt:VehLic ALIGN LEFT
    add to oLbwlu Header "Year" data oUnt:VehYer ALIGN LEFT
    add to oLbwlu Header "Make" data oUnt:VehMak ALIGN LEFT
    add to oLbwlu Header "Model" data oUnt:VehMod ALIGN LEFT

    // Provide the header gradient
    oLbwlu:bClrGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
        { 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
    // Set the header and row heights
    oLbwlu:nHeaderHeight := 30
    oLbwlu:nRowHeight := 24
    oLbwlu:nStretchCol := STRETCHCOL_WIDEST

    // Turn off horizontal scrolling
    oLbwlu:lHScroll := .F.
    // Set the styles
    oLbwlu:nMarqueeStyle := MARQSTYLE_HIGHLROW
    oLbwlu:nColDividerStyle := LINESTYLE_RAISED
    oLbwlu:nRowDividerStyle := LINESTYLE_RAISED
    // Use for incremental search on opened database
    oLbwlu:bSeek := { |c| oUnt:Seek( Upper( c )) }
    FOR nCCol := 1 TO LEN( oLbwlu:acols )
        oLbwlu:aCols[nCCol]:nHeadStrAlign  := AL_CENTER
    NEXT

    // Activate dialog
    ACTIVATE DIALOG oDpw0 ON PAINT oLbwlu:setfocus( ) ON INIT oDpw0:center(wndmain())

   RELEASE BRUSH oBrush
   RELEASE FONT oMFont

return nil
 

Now, can you test this code (exactly without altering anything) with the above rc in a separate folder with xharbour commercial and VC2013 and see if you get any different results?
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Wed Dec 30, 2015 5:20 pm

I built with 15.11. The sample works, but my code still has the same problem.

I will need to go back and look more closely at other programs I link in to see if I can find an issue. I will let you know if I find anything.
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby TimStone » Thu Dec 31, 2015 12:03 am

OK ... here is what I found ...

As a stand alone program, with just the one file, it works. However, when I added it into a build with all of the programs in the executable, the same spacing problem arises.

I went back to 15.09 r5 and it seemed to work in many cases, but there were issues still. In addition, we found that the older versions were now doing a wash of the brush after a number of subroutines were called. If I maximized the display, it fixed the problem, but if I resized the window smaller, it was problematic.

I finally went all the way back to 15.04 and most of the issues cleared up.

Finally, I removed png.lib and xfw.lib and the problems went away completely.

So, we are apparently getting conflicts in 15.10 and 15.11 with the existing png.lib and xfw.lib, using xHarbour ( .com ) builds. The problems are being reported by a number of clients.

This is an older version of my software which needs to be updated from time to time. Hopefully in the coming months I can get everyone moved to the new Harbour / MSVC++ 2013 version and get past these issues. However, for those using xHarbour ( .com ) finding out what is actually causing the issues here might be helpful.

Tim
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Thu Dec 31, 2015 3:57 am

Good that the problem is resolved. With bcc and msvc builds we never experienced any such problems

The requirement of png.lib was removed many versions earlier.

General advice about the recommended syntax for creation of xbrowse:

The syntaxes:
... XBROWSE .. FIELDS ...
and
ADD TO oBrw DATA ...

were provided only for easier migration from WBrowse and TCBrowse, but not well suited.
In these cases, the column data is provided to xbrowse as codeblocks and xbrowse can not learn any more information about these columns.


Recommended sytanx is :

@ r.c (or) REDEFINE XBROWSE ...... DATASOURCE <Alias/oDbf/oRs/oQry/Array> ;
COLUMNS "col1", "col2", ......

In this case, XBrowse examines the field properties of the columns and decides the optimal behavior required, like datat type, data defined width, actual width, index order corresponding to the fields and so on.
We recommend this usage to avail the full capabilities of xbrowse including a more ingelligent behavior suitable to the data
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Thu Dec 31, 2015 8:46 pm

I will try that. I haven't had problems in the past, but the column issue is still unresolved. I'll try reformatting the command structure.
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby TimStone » Wed Jan 06, 2016 10:34 pm

I have a couple of questions on that preferred formatting. I checked, but can't find full samples or documentation.

1) With the command, instead of ALIGN I see you use the word JUSTIFY. In one browse, the first column is a BMP which I want centered. I've set the column to JUSTIFY 2 which is the value for center, but it won't make a change there. Of course, to assign the BMP I had to use class data assigns after creating the control. How could I get it to center the value bmp under the new structure ?

2) In the same browse, one of the values is calculated based on the value in a field. When I used the ADD COLUMN format previously, I was able to use an := IIF( ) clause to assign the value. I tried that here and the compiler then comes up with an error in another part of the code ( centering all headers ) which is several lines later. Without the clause, it compiles fine. Here is the original line:

add to oLbxo Header "Action" data IIF( oOrders:duedat = DATE( ), "< TODAY >",IIF( oOrders:duedat < DATE( ),"Overdue" ," " )) ALIGN CENTER SIZE 150

I tried to use this:

oLbxo:aCols[9] := IIF( oOrders:duedat = DATE( ), "< TODAY >",IIF( oOrders:duedat < DATE( ),"Overdue" ," " ))

Which then created an error with the following line during compile.

oLbxo:aCols[nCCol]:nHeadStrAlign := AL_CENTER

It tells me nHeadStrAlign is not a recognized method. Of course without the aCols[9] assign line it compiles fine and works.

Any guidance would be appreciated.
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Thu Jan 07, 2016 2:45 pm

This is an example how to use expressions as part of COLUMN syntax:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function testa()

   local oDlg, oBrw, oDbf, oFont

   FWNumFormat( 'A', .t. )

   oDbf := TDataBase():New( nil, "CUSTOMER", "DBFCDX" )
   oDbf:Use()
   oDbf:GoTop()

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 700,500 PIXEL FONT oFont

   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE oDbf ;
      COLUMNS "MARRIED", "Trim(First) + ', ' + Last", "HireDate", ;
         "IF(YEAR(HIREDATE) < 1990, 'VERYOLD', 'RECENT' )", "Salary"  ;
      HEADERS "Status", "Name", nil, "HowOld" ;
      SORT nil, "First", nil, "hiredate" ;
      AUTOSORT ;
      CELL LINES NOBORDER FOOTERS

   WITH OBJECT oBrw
      :nEditTypes  := EDIT_GET
      :aCols[ 1 ]:SetCheck( nil, .t. )
      :Salary:nFooterType  := AGGR_SUM
      :MakeTotals()
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil


Image

Alignment:
We use JUSTIFY clause for alignment. This alignment applies to only Data in the cells. But mostly it is not necessary to specify alignment because XBrowse, by default, automatically aligns
- Numeric and date values to Right
- Character values to Left
- Bitmaps without any text to Center.
We need to use Justify clause or specify alignment only when we want an unusual alignment of numbers to left/center or text to right/center.

Fine tuning of alignments:
nHeadStrAlign
nDataStrAlign
nDataBmpAlign
nFootStrAlign

Please also note that the above syntax is fully portable across RDD, TDataBase, ADO.
By simply changing the variable following "DATASOURCE" clause to oDbf, cAlias, oRs this code without changing even one character works for RDD, TDataBAse, ADO recordset ( of any SQL database)
Regards

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

Re: 15.10 Browse problem

Postby nageswaragunupudi » Thu Jan 07, 2016 6:06 pm

Having said that I started thinking. I found some programmers, in addition to you, have been extensively using "add to obrw..." syntax. Naturally they are comfortable with that syntax. I am wondering if i can modify this syntax also to be equally powerful. I need a little time.
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Thu Jan 07, 2016 6:19 pm

I'm actually working to make the changes. I do not have a problem with it, though it means a lot of changes. Once I get used to it, it becomes clear.

I do have one question. If I use the JUSTIFY can I do ,,,2,,,2,, or do I then have to specify each column, ie. 0,0,2,1,1,2,0,0 In some cases I have text I want to center, and not left justify.

Also, I'm not seeing bitmaps centering in a column. They are left justifying with what I provided in the sample.

Finally, my code is all RESOURCE driven, so create from code does not work out. That may be part of the issue with some of the problems.

Tim
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 11 guests

cron