SetMultiSelectCol() on line

SetMultiSelectCol() on line

Postby Silvio.Falconi » Sat Apr 13, 2024 8:32 am

I have an xbrowse created with an array without the :SetMultiSelectCol()
and I have the ability to display a menupopup like this

MENU oMenu POPUP
if oBrw:IsSelectedRow()
MENUITEM "Deselect the current row" action DeSelect_One_array(oBrw)
MENUITEM "Deselect everything" action oBrw:SelectRow( 0 )

MENUITEM "Prints the selected lines" action PrintBrowse(oParent:cCaption,oBrw,oDbf)
MENUITEM "Export the selected rows" action ExportToExcel(oBrw )
else //
MENUITEM "Select the current row" action oBrw:SelectRow( 2 )
MENUITEM "select all" action oBrw:SelectRow( 4 )

MENUITEM "Print " action NIL //PrintBrowse(oParent:cCaption,oBrw,oDbf)
....


Before making the selection, I would like to check whether SetMultiSelectCol() is activated in the xbrowse and if it has not been activated, activate it on first column before the selection. Obviously, when no records are selected, SetMultiSelectCol() must disappear

how can I implement this?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6777
Joined: Thu Oct 18, 2012 7:17 pm

Re: SetMultiSelectCol() on line

Postby Silvio.Falconi » Mon Apr 22, 2024 10:46 am

Any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6777
Joined: Thu Oct 18, 2012 7:17 pm

Re: SetMultiSelectCol() on line

Postby Antonio Linares » Mon Apr 22, 2024 11:45 am

Dear Silvio,

Could you please provide a small and self contained PRG example ?

thanks!
regards, saludos

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

Re: SetMultiSelectCol() on line

Postby Silvio.Falconi » Tue Apr 23, 2024 7:40 am

Antonio Linares wrote:Dear Silvio,

Could you please provide a small and self contained PRG example ?

thanks!



this is a small sample

Code: Select all  Expand view


#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

// test array

Function test()
local oDlg,oFont,oBold
local oBrw,aBtnBrow:=array(3)
local adata:= { {"0001","aaaaaaaaaaaaaaa","00001"},; // Demo data
                {"0001","bbbbbbbbbbbbbbb","00002"},;  
                {"0001","ccccccccccccccc","00003"},;
                {"0001","ddddddddddddddd","00004"},;
                {"0001","eeeeeeeeeeeeeee","00005"}}

   local nBottom:= 8    
   local nRight := 55
   local nHt    := nBottom * DLG_CHARPIX_H
   local nWd    := Max( nRight * DLG_CHARPIX_W, 180 )
   local nRow:= 0,nCol:= 10
   local nInterlinea := 30

  oFont := TFont():New( "TAHOMA", 0, 16,, )
  oBold := TFont():New( "TAHOMA", 0, 16,,.t. )

 DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
       FONT oFont  TiTle "test" COLOR CLR_BLACK, CLR_WHITE  ;
       STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
                  WS_MINIMIZEBOX)

@  nRow, 10 XBROWSE  oBrw OF oDlg ;
                 COLUMNS 2;
                 HEADERS "Valore" ;
                 COLSIZES 310 ;
                 ARRAY aData      ;
                 SIZE -10,-30 PIXEL STYLE FLAT NOBORDER
           

              WITH OBJECT oBrw
                   :lDrawBorder := .t.
                   :lHScroll  := .f.
                   :CreateFromCode()
                  END


   @ oBrw:nBottom+2, 50  BTNBMP aBtnBrow[3] ;
     RESOURCE "GRID_MNU", "", "", "" ;
      SIZE 15, 13 PIXEL FLAT NOROUND GDIP  OF oDlg ;
      ACTION ::ShowPopUp( Contextual_Menu( Self,oBrw,oDlg ) )


                  oDlg:bResized  := <||
                   local oRect         := oDlg:GetCliRect()
                    aBtnBrow[3]:setsize(30,   26.2)
                  aBtnBrow[3]:nTop   := oRect:nBottom-26
                  aBtnBrow[3]:nLeft  := oRect:nWidth-36

                  RETURN nil
                   >

                   ACTIVATE DIALOG oDlg  CENTER;
                   ON INIT oDlg:resize()
RETURN NIL

//------------------------------------------------------//
Function Contextual_Menu( Self,oBrw,oDlg )
local oMenu


MENU oMenu POPUP
           if oBrw:IsSelectedRow()
              MENUITEM "Deselect row" action DeSelect_One_array(oBrw)
              MENUITEM "Deselect all" action oBrw:SelectRow( 0 )
              MENUITEM "Print"  action NIL
              MENUITEM "Export" action NIL
           else                                                
              MENUITEM "Select"       action oBrw:SelectRow( 2 )
              MENUITEM "Select all"   action oBrw:SelectRow( 4 )
              MENUITEM "Print"        action NIL
              MENUITEM "Export"       action NIL
        endif
 ENDMENU
     return oMenu
//------------------------------------------------------//
Function DeSelect_One_array(oBrw)
   local  nRecNo,nAt
      nRecNo:=oBrw:nArrayAt
   if ( nAt := AScan( oBrw:aSelected, nRecNo ) ) > 0
        HB_ADel( oBrw:aSelected, nAt, .t. )
    endif
    oBrw:Refresh()
 return nil
//----------------------------------------------------------//
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6777
Joined: Thu Oct 18, 2012 7:17 pm

Re: SetMultiSelectCol() on line

Postby Antonio Linares » Tue Apr 23, 2024 5:22 pm

Dear Silvio,

Have you reviewed samples\xbmulsel.prg ?
regards, saludos

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

Re: SetMultiSelectCol() on line

Postby Silvio.Falconi » Tue Apr 23, 2024 6:51 pm

Antonio Linares wrote:Dear Silvio,

Have you reviewed samples\xbmulsel.prg ?


yes allready saw it

compile this test without :SetMultiSelectCol() you'll see this error

Error description: Error BASE/1005 No exported variable: LREADONLY
Args:
[ 1] = U
[ 2] = L .T.

Stack Calls
===========
Called from: xbmulsel.prg => _LREADONLY( 0 )
Called from: xbmulsel.prg => (b)MAIN( 38 )



Maybe I did not say it clear enough

I would like the procedure to check whether xbrowse has/does not have :SetMultiSelectCol()

if it does not have the :SetMultiSelectCol() the procedure must create the :SetMultiSelectCol() as the first column of the xbrowse and give the possibility to select the row

If there are no selected rows in the xbrowse the procedure must remove the :SetMultiSelectCol()

instead the test samples\xbmulsel.prg example already has the SetMultiSelectCol and the checkbox disables it but physically it is still in the xbrowse

I hope I was clear in my explanation
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6777
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 5 guests