xBrowse header sort change picture

xBrowse header sort change picture

Postby Otto » Sat Jan 31, 2009 8:16 pm

At the moment if I change the sort order of xBrowse I use to change the header picture :
oxBrw:LButtonDown( 1, 61, 0 )
oxBrw:LButtonUp( 1, 61, 0 )
to simulate a click on the header.
Sure there is a better way.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse header sort change picture

Postby ukoenig » Sun Feb 01, 2009 10:54 pm

Hello Otto,

can You explain a bit more in detail, what You want to do ?
There are many possible ways, to change the sort order of the columns :
On Button-action, move the columns with the mouse,
swap columns with mouse-click on a header, right mouse-click inside a data-area and more ...
Just like the text of the header, You can change the bitmap as well on any action.
There is no header-click necessary.
I have done some solutions, but I don't know what to use for Your application.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: xBrowse header sort change picture

Postby Otto » Mon Feb 02, 2009 7:54 am

Hello Uwe,
thank you for your answer.
This is what I want to do:
I delete a record –
then I refresh() the xbrowse –
after the xbrowse gets focus again I want that the sort order is on column 1.
The bitmap must be changed that column 1 is selected.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse header sort change picture

Postby ukoenig » Mon Feb 02, 2009 2:24 pm

Hello Otto,

I included the header-painting inside the delete-button-action
It is just the basics, to give You a idea, much more fine-tuning is possible.
There could be a test, if the database contains no deleted record < recall >,
change back to green and so on.
A solution could be, a index on deleted records.
In this case, using the delete-button for delete or recall, You only need to test the 1. Record :

A function could include something like that :
Code: Select all  Expand view

FUNCTION TEST_DEL()
local lDel := .F.
local nOldOrder := INDEXORD()
local nOldrecord := RECNO()

DBSELECTAREA(1)
Net_RLock( 1, 1 )
IF DELETED()
      Net_Recall( 1, 1 )
ELSE
      Net_Delete ( 1, 1 )
ENDIF
Net_ULock()

DBSETORDER( 2 ) // index on deleted
DBGOTOP()
IF deleted()
      lDel = .T.
ENDIF
DBSETORDER( nOldORDER )
DBGOTO( nOldrecord )

RETURN( lDel )



I think You want the header marked, if the database has any deleded records included ?

Code: Select all  Expand view
....
....

// 1. Column
// -------------
oCol := oLbx1:AddCol()
oCol:AddResource( "Green" )
oCol:bStrData := { || (1)->Last}
oCol:cHeader  := "Last"
oCol:cFooter  := "Last"
oCol:nHeadBmpNo := 1

// 2. Column ( Indexed )
// --------------------------
oCol := oLbx1:AddCol()
oCol:AddResource( "Green" )
oCol:AddResource( "Red" )
oCol:bStrData  := { || (1)->First}
oCol:cHeader   := "First"
oCol:cFooter  := "First"
oCol:bBmpData := {|| IIF( deleted(), 2, 1 ) }
oCol:nHeadBmpNo := 1

// 3. Column
// ------------
oCol := oLbx1:AddCol()
oCol:AddResource( "Green" )
oCol:bStrData := { || (1)->City}
oCol:cHeader  := "City"
oCol:cFooter  := "City"
oCol:nHeadBmpNo := 1
....
....

// Use Your delete-function or include < TEST_DEL() >

// REDEFINE BUTTONBMP oBtn7  ID 70 OF oDlg ;
// ACTION ( IIF( TEST_DEL() = .T., ; 
//      ( oLbx1:SwapCols( 1, 2 ), ;   // Bring selected col 2 ( indexed ) to 1
//        oLbx1:GoLeftMost(), ;         // Go to 1. Col ( indexed )
//        oLbx1:aCols[1]:nHeadBmpNo := 2 ), ; // Red BMP from Col-resource
//      oLbx1:aCols[1]:nHeadBmpNo := 1 ), ; // Green BMP from Col-resource
//      oLbx1:Refresh() ) ;
// BITMAP "Delete" PROMPT "       &Delete" TEXTRIGHT
// oBtn7:cToolTip =  { "Delete" + CRLF + ;
// "a Record","Record-Delete", 1, CLR_BLACK, 14089979 }

// If TEST_DEL() = .F., reset the swapt columns to the original positon with a Green BMP.

REDEFINE BUTTONBMP oBtn7  ID 70 OF oDlg ;
ACTION ( DB_SET(), ;   // Delete and Recall-function
      oLbx1:SwapCols( 1, 2 ), ;   // Bring selected col 2 ( indexed ) to 1
      oLbx1:GoLeftMost(), ;         // Go to 1. Col ( indexed )
      oLbx1:aCols[1]:nHeadBmpNo := 2, ; // Red BMP from Col-resource
      oLbx1:Refresh() ) ;
BITMAP "Delete" PROMPT "       &Delete" TEXTRIGHT
oBtn7:cToolTip =  { "Delete" + CRLF + ;
"a Record","Record-Delete", 1, CLR_BLACK, 14089979 }



The basic-view
Image

After deleting
Image

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests