15.10 Browse problem

Re: 15.10 Browse problem

Postby nageswaragunupudi » Thu Jan 07, 2016 6:34 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 know what it means to change existing code. We are likely to create more problems than we solve. I do not advise changing existing code. Please keep my advice for future. I shall also post another variant of the syntax. (My personal preference)

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.

1. ",,,2,,,2,," Ths is ok. We also do not need trailing commas. ",,,2,,,2" is enough.
Also, I'm not seeing bitmaps centering in a column. They are left justifying with what I provided in the sample.

I can help better if I see some examples.
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.

This should not make any difference. You should not use CreateFromCode(). If you ceate browse with command syntax, you should not use CreateFromResource() also.
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Thu Jan 07, 2016 7:08 pm

I know what it means to change existing code. We are likely to create more problems than we solve. I do not advise changing existing code. Please keep my advice for future. I shall also post another variant of the syntax. (My personal preference)


This is a different situation. My main software program has been extensively revised over the past year. So going in and making this change at this time is good because it is not yet in full distribution. All I'm doing here is substituting code that is actually more compact for longer lines of code. I do each one individually, and thus nothing is "broken"

So here is another section of code that we have to add to all browses. Are any of these covered in the COMMAND structure you are using:

Code: Select all  Expand view  RUN


//  This is the new call we are using:
   REDEFINE XBROWSE oLbxo  ;
    DATASOURCE oOrders  ;
    HEADERS "Stage", "Type", "W/O #", "Company", sLbl[1], "Due Date", "Time", "Status" ;
    COLUMNS NIL, "status", "wrkord", "ordcom", "ordveh", "duedat", "duetim", "CliUs1" ;
    JUSTIFY  2, 2, 2, 0, 0, 2, 2, 2 ;
    ID 390  ;
    OF  oWdlg ;
    ON DBLCLICK ( tWorkorder():New( oOrders:WrkOrd ):FullEdit( ), oLbxo:skip( ), aDis := LoadDispValues( aDis, oOrders ), oWdlg:update()) ;
        ON CHANGE ( aDis := LoadDispValues( aDis, oOrders ), oWdlg:update() ) UPDATE

      oLbxo:aCols[1]:AddResource("CM1")
        oLbxo:aCols[1]:AddResource("CM2")
        oLbxo:aCols[1]:AddResource("CM3")
        oLbxo:aCols[1]:bBmpData   := { || IIF( oOrders:totals, 3, IIF( oOrders:ordnot, 1,2 ) ) }

// And this is the code that we still have from the old method with Add columns.  Can any of this be incorporated in the section above

    // Provide the header gradient
    oLbxo: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
    oLbxo:nHeaderHeight := 30
    oLbxo:nRowHeight := 24
    oLbxo:nStretchCol := STRETCHCOL_WIDEST
    // Turn off horizontal scrolling
    oLbxo:lHScroll := .F.
    // Set the styles
    oLbxo:nMarqueeStyle := MARQSTYLE_HIGHLROW
    oLbxo:nColDividerStyle := LINESTYLE_RAISED
    oLbxo:nRowDividerStyle := LINESTYLE_RAISED
    FOR nCCol := 1 TO LEN( oLbxo:acols )
        oLbxo:aCols[nCCol]:nHeadStrAlign  := AL_CENTER
    NEXT

 


Any compaction of code is good !
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Fri Jan 08, 2016 12:10 am

Can any of this be incorporated in the section above

No
Any compaction of code

Following lines
Code: Select all  Expand view  RUN

oLbxo:aCols[1]:AddResource("CM1")
oLbxo:aCols[1]:AddResource("CM2")
oLbxo:aCols[1]:AddResource("CM3")
 

can be written as:
Code: Select all  Expand view  RUN

oLbxo:aCols[1]:AddBitmap( { "CM1", "CM2", "CM3" } )
 

Each element of this array can be either resource or any image file.

The following code
Code: Select all  Expand view  RUN

    FOR nCCol := 1 TO LEN( oLbxo:acols )
        oLbxo:aCols[nCCol]:nHeadStrAlign  := AL_CENTER
    NEXT
 

can be written as:
Code: Select all  Expand view  RUN

oLbxo:nHeadStrAligns  := AL_CENTER
 


Assigning oBrw:<data>s := x is internally translated as assigning x to <data> of every column.
Instead of assigning a single value, we can also assign an array of values.

oBrw:nFootStrAligns := { AL_CENTER, AL_RIGHT, AL_LEFT }
is same as assigning oBrw:oCol( 1 ):nFootStrAlign := AL_CENTER, oBrw:oCol( 2 ):nFootStrAlign := AL_RIGHT, and so on.
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Fri Jan 08, 2016 12:18 am

I edited that and apparently it did not update:

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

In this segment, a string value is placed in the cells of a column based on the value of duedate.

I tried using oLbx:aCols[10] := IIF( .... ) but that led to an error when centering headers at runtime.

How should this be rewritten

And one other thing. The Row and Col line styles end at the last row of data using my setup in the earlier provided code. However, if I simply use LINES in the XBROWSE statement, it creates them but continues the column lines to the bottom of the page. The Style looks nicer because it doesn't have a lot of blank lines.
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Fri Jan 08, 2016 4:36 am

While using the COLUMNS syntax use this entire expression in Quotes as one of the columns;
eg:
COLUMNS "fld1", "fld2", "IIF( duedat = DATE( ), '< TODAY >',IIF( duedat < DATE( ),'Overdue' ,'' ))", "fld5", .. etc
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Fri Jan 08, 2016 5:44 am

Here is the final format:

Code: Select all  Expand view  RUN

   
REDEFINE XBROWSE oLbxo  ;
    DATASOURCE oOrders  ;
    HEADERS " Stage ", "Type", "W/O #", "Company", sLbl[1], "Due Date", "Time", " Status ", "  Action  " ;
    COLUMNS nil, "status", "wrkord", "ordcom", "ordveh", "duedat", "duetim", "CliUs1",  ;
    "IIF( duedat = DATE( ), '< TODAY >',IIF( duedat < DATE( ),'Overdue' ,'  ' ))";
    JUSTIFY  ,2,2,,,2,2,2 ;
    ID 390  ;
    OF  oWdlg ;
    ON DBLCLICK ( tWorkorder():New( oOrders:WrkOrd ):FullEdit( ), oLbxo:skip( ), aDis := LoadDispValues( aDis, oOrders ), oWdlg:update()) ;
        ON CHANGE ( aDis := LoadDispValues( aDis, oOrders ), oWdlg:update() ) UPDATE

  // Column 1 status bitmaps  
  oLbxo:aCols[1]:AddBitmap( { "CM1", "CM2", "CM3" } )
  oLbxo:aCols[1]:bBmpData   := { || IIF( oOrders:totals, 3, IIF( oOrders:ordnot, 1,2 ) ) }
  // Provide the header gradient
  oLbxo:bClrGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
        { 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
  // Set the styles
  oLbxo:nMarqueeStyle := MARQSTYLE_HIGHLROW
  oLbxo:nColDividerStyle := LINESTYLE_RAISED
  oLbxo:nRowDividerStyle := LINESTYLE_RAISED
  oLbxo:nHeadStrAlign  := AL_CENTER

 


Using the IIF clause for the last column, at runtime, the program has an error with nHeadStrAlign as an undeclared method.
If I comment out the IIF clause, no error. If I comment out the nHeadStrAlign everything displays correctly. However with this last option, I do not have centered headers which looks much better.

Any thoughts on this ?

Also, the bitmaps defined for column 1 left justify. I can't get them to center. With the Add Column syntax, they did center. The two bitmaps are a checkmark and a star.
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Fri Jan 08, 2016 7:52 am

Not
Code: Select all  Expand view  RUN
oLbxo:nHeadStrAlign  := AL_CENTER
 

Please use PLURAL
Code: Select all  Expand view  RUN
oLbxo:nHeadStrAligns  := AL_CENTER
 


Suggestion: Please do not pad Headers with spaces. Where needed better use nHeadStrAlign(s)

oLbx0:aCols[ 9 ]:nHeadStrAlign := AL_CENTER should not give any error.
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Fri Jan 08, 2016 4:04 pm

It does give an error so I decided to abandon the column. I'm looking at another approach.

Also, bitmaps do not center either with JUSTIFY or by specifying it individually. They do with SetCheck but not called bitmaps as shown in this example. They did in the ADD Column method

Finally, the reason I added spaces to the header titles is for appearance. If the data width is smaller than the header, the column does set to the header size. However, in the first and last column, the text is squeezed and on my monitor the letters by the column lines fade making it hard to read. By putting in the space, the headers are clear.
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby nageswaragunupudi » Fri Jan 08, 2016 4:58 pm

Are you using TDataBase?
Regards

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

Re: 15.10 Browse problem

Postby TimStone » Fri Jan 08, 2016 5:18 pm

tData ( James Bott ) which is an extension of tDatabase.

Actually, all of my databases are themselves object classes as subclasses of tdata, thus:

oOrders <- tData <- tDatabase
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby TimStone » Fri Jan 08, 2016 8:07 pm

See my previous response, then here is some new stuff:

Old code:
Code: Select all  Expand view  RUN

    // Define the browse contol
    REDEFINE XBROWSE oLBxcl ID 860 OF oFldCSE:aDialogs[ 1 ] ;
     ON CHANGE ( oClientsr:load(), oFldCSE:aDialogs[ 1 ]:update() );
     ON DBLCLICK (  lCliScoped := oServiceUnits:ScopeUnits( oClientsr, lCliScoped ), oLbvm:refresh( ),;
    oServiceUnitsr:load( ), oFldCSE:aDialogs[2]:update( ),oFldCSE:setoption(2)   ) UPDATE

    // Attach the database
    oLbxcl:setoDBF( oClients )

    // Add the columns
        add to oLbxcl header "Account" data oClients:acrnum ALIGN CENTER ORDER "eclnum" SIZE 100
        add to oLbxcl Header "Client" data oClients:clicom ALIGN LEFT ORDER "eclcom" SIZE 300
        add to oLbxcl header "City" data oClients:clicty ALIGN LEFT SIZE 200
        add to oLbxcl Header "Phone" data oClients:clipho ALIGN LEFT ORDER "eclpho" SIZE 170
        add to oLbxcl Header "Cellular" data oClients:clicel ALIGN LEFT SIZE 170
        add to oLbxcl Header "Email" data oClients:clieml ALIGN LEFT SIZE 250
        add to oLbxcl Header "Last Visit" data oClients:clidls ALIGN RIGHT SIZE 120
        add to oLbxcl Header "Total Sales" data oClients:acrytd ALIGN RIGHT  SIZE 120
 


Replaced with:
Code: Select all  Expand view  RUN

  REDEFINE  XBROWSE  oLBxcl ;
      DATASOURCE oClients  ;
      HEADERS "Account", "Client", "City", "Phone", "Cellular", "Last Visti", "Total Sales", "Email" ;
      COLUMNS "acrnum", "clicom", "clicty", "clipho", "clicel", "clidls", "acrytd", "clieml"  ;
      ORDERS  "eclnum","eclcom",,"eclpho"  ;
      ID 860 ;
      OF  oFldCSE:aDialogs[ 1 ];
      ON CHANGE  ( oClientsr:load(), oFldCSE:aDialogs[ 1 ]:update() )  ;
      ON DBLCLICK (  lCliScoped := oServiceUnits:ScopeUnits( oClientsr, lCliScoped ), oLbvm:refresh( ),;
            oServiceUnitsr:load( ), oFldCSE:aDialogs[2]:update( ),oFldCSE:setoption(2)   ) ;
      UPDATE
 


Followed in both cases by:
Code: Select all  Expand view  RUN

    // Provide the header gradient
    oLbxcl:bClrGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
        { 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
    // Set the styles
    oLbxcl:nMarqueeStyle := MARQSTYLE_HIGHLROW
    oLbxcl:nColDividerStyle := LINESTYLE_RAISED
    oLbxcl:nRowDividerStyle := LINESTYLE_RAISED
    oLbxcl:nHeadStrAligns  := AL_CENTER
        oLbxcl:lHScroll := .t.
    // Use for incremental search on opened database
    oLbxcl:bSeek := { |c| oClients:Seek( Upper( c )) }
 


And from the .rc dialog:
Code: Select all  Expand view  RUN

    CONTROL         "",860,"TxBrowse",WS_BORDER | WS_VSCROLL | WS_TABSTOP,5,195,640,170
 


The old code worked fine except we have to now specify the SIZE variable in all browses. When clicking on a column header it would apply the index and reorder the column, and show the ^ symbol in the header cell

The new code requires a change to the .rc file to add WS_HSCROLL to the browse control. In addition, the browse no longer responds to the click on the header to change the order.

Please note, your samples use the build from code options. These are all REDEFINE of resources. In addition, this is within a folder defined within a dialog.

All of the old coding works with 15.09 but fails on .11 and .12. I have no problem with new coding, but there do appear to be problems with it still. If you see something in my code that is wrong, I will make changes and test it. This is actual code and it has been working for years with 15.09 and earlier versions.

I actually prefer the new code. Once it works correctly, it is going to be more compact and easier to debug.

Built with FWH 15.12, Harbour, MSVC 2013


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

Re: 15.10 Browse problem

Postby TimStone » Wed Jan 13, 2016 5:59 pm

This is still an open / unresolved issue
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: 15.10 Browse problem

Postby TimStone » Wed Jan 27, 2016 6:07 pm

The original part of this post was never resolved. I did go into our new version of the software and reformatted all of the Browse controls to fit the new command pattern suggested.

This morning I found another piece of information that may help with understanding the problem in the ADD TO format. In that problem the first column would be very large, and the remaining columns would be scrunched together on the right side. Previously, they would auto format. To resolve it I've had to use the SIZE value to specify widths.

A client showed me one today that was still displaying incorrectly. He then went to one of the column lines in the compressed fields and pulled it to the side a bit. The display then reformatted correctly.

So it would appear that when the browse displays it is not auto calculating. Try to change the width a bit and it redisplays correctly.

Maybe this can help find the error in that code. The problem surfaced between 15.09 and 15.11/12

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

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 39 guests