FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour popup on Listview class
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
popup on Listview class
Posted: Sat Jun 20, 2015 03:17 PM
I made the popup menu for Listview
I hope Antonio insert it on new release of this class


add new defines

Code (fw): Select all Collapse
#define LVS_ICON                  0
#define LVS_SMALLICON         2
#define LVS_LIST                  3



add new data
Code (fw): Select all Collapse
 DATA  lPopUp


add new method
METHOD PopMenu( nRow, nCol, nKey )

add lpopup on new and define method

default lPopUp := .F.

and

::lPopUp = lPopUp


add these lines on Paint Method

Code (fw): Select all Collapse
 IF ::lPopUp
      ::bRCliCked := {| nRow, nCol, nKey | ::PopMenu( nRow, nCol, nKey ) }
   ENDIF





Popup method

Code (fw): Select all Collapse
METHOD PopMenu( nRow, nCol, nKey ) CLASS TListView
      LOCAL oPopup
      Local oLv := self

      MENU oPopUp POPUP

          if WndMain() != nil .and. WndMain():oMenu != nil .and. WndMain():oMenu:l2010
            oPopUp:l2010    := .t.
         else
            oPopUp:l2007    := .t.
         endif

   MENUITEM "Big Icons"   Action SetWindowLong( oLv:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_ICON ) )
   MENUITEM "Small Icons" Action SetWindowLong( oLv:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_SMALLICON ) )
   MENUITEM "List"        Action SetWindowLong( oLv:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_LIST ) )

ENDMENU

   ACTIVATE POPUP oPopup OF Self AT nRow, nCol

   RETURN (Nil)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 08:19 AM

Dear Antonino or Antonio...

the big icons and list run ok

the samll icons not run (I not see icons on listview but only the captions )

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 09:58 AM
You should create 2 imageListes, one for big icons and one for small icons, like:
Code (fw): Select all Collapse
LOCAL oImageListBig := TImageList():New(32,32)
LOCAL oImageListSmall := TImageList():New(16,16)

Then call
Code (fw): Select all Collapse
oList:SetImageList(oImageListBig ,0)
oList:SetImageList(oImageListSmall,1 )

Regards,
Antonino
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 10:10 AM
not run

test.prg

Code (fw): Select all Collapse
  

  # include "fivewin.ch"



#define LVS_ICON              0
#define LVS_SMALLICON         2
#define LVS_LIST              3

    static oList
    static oImageList
    static oImageListBig
    static oImageListSmall

    Function test()
    Local oDlg
    local obtn[5]
    Define Dialog oDlg  size 400,400



    @ 1,10 button obtn[1] prompt " delete item" action  nil
    @ 10,10 button obtn[2] prompt " rename item" action  nil


    @ 8,10 button obtn[3] prompt "Big"   SIZE 35,10 action give_type(1)
    @ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action give_type(2)
    @ 8,25 button obtn[5] prompt "List"  SIZE 25,10 action nil


    activate dialog oDlg;
    ON INIT Crealistview(oDlg)
    return nil
    //----------------------------------------------------------------------//

Function give_type(n)

   Do Case
   case n=1
          oList:SetImageList(oImageListBig ,1)
          oList:SetImageList(oImageListSmall,0 )
       case n=2
          oList:SetImageList(oImageListBig ,0)
          oList:SetImageList(oImageListSmall,1 )
       endcase
       return nil

       
  //----------------------------------------------------------------------//


    Function Crealistview(oDlg)

       Local nOption     := 1
       local bAction:= { | nOption | Optionfile( oList ) }



       oImageList := TImageList():New(32,32)
       oImageList:hImageList := Fix(32,32)

       oImageListBig := TImageList():New(32,32)
       oImageListBig:hImageList := Fix(32,32)

       oImageListSmall := TImageList():New(16,16)
       oImageListSmall:hImageList := Fix(16,16)


       oList := TListView():New(oDlg:nHeight-300,2,{},bAction, oDlg, ,,.T., .F., oDlg:nwidth-25,150, )
       oList:SetImageList(oImageList)



       // toglie il dotted
       oList:WinStyle(/*LVS_SINGLESEL*/4,.T.)
       oList:lPopUp:= .f.






       DragAcceptFiles( oList:hWnd, .T. )
       oList:bDropFiles = {|nRow,nCol,aFiles| Drop(oList,oImageList,nRow,nCol,aFiles) }


     return nil





    Procedure Drop(oList,oImageList, nRow,nCol,aFiles)
       local cFile, nImage, oItem
       for each cFile in aFiles
          nImage := Icon_Read(cFile)
          //MSgInfo(cFile + STR(GetLastError()))
          //Aggiungi_record(cFile)
          nImage := max(0,ILADDICON( oImageList:hImageList, nImage ) )
          DestroyIcon(nImage)
          // oList:InsertItem(nImage, cFile, 0)
          oItem = TListViewItem():New( oList )
          oItem:cText = cFile
          oItem:nImage = nImage
          oItem:Create()
       next
    return





    function Optionfile(oList)

       Local nfile:= oList:nOption

       msginfo(str(oList:nOption))

       msginfo( oList:aItems[nFile]:cText )
    return nil



         #pragma BEGINDUMP
        #include <windows.h>
        #include <hbapi.h>
        #include <CommCtrl.h>

        HB_FUNC( FIX )
        {
           typedef HIMAGELIST ( __stdcall * PIMAGELIST_CREATE ) ( int cx, int cy,
                                UINT flags, int cInitial, int cGrow );
           static PIMAGELIST_CREATE pImageList_Create = NULL;

      if( pImageList_Create == NULL )
       {
          HMODULE hDLL = LoadLibrary( "comctl32.dll" );
          if( hDLL )
             pImageList_Create = ( PIMAGELIST_CREATE ) GetProcAddress( hDLL, "ImageList_Create" );
          FreeLibrary(hDLL);
       }

        #ifndef _WIN64
          hb_retnl( ( LONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                     ILC_MASK | ILC_COLOR32, 0, 50 ) );
        #else
           hb_retnll( ( LONGLONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                     ILC_MASK | ILC_COLOR32, 0, 50 ) );
        #endif
        }


        HB_FUNC( LVDELETEITEM )
    {
         #ifndef _WIN64
          HWND hWnd = ( HWND ) hb_parnl( 1 );
       #else
          HWND hWnd = ( HWND ) hb_parnll( 1 );
       #endif

       ListView_DeleteItem( hWnd, hb_parnl( 2 ) );
    }


      HB_FUNC( LVSETITEMTEXT )
    {
       LV_ITEM _ms_lvi;

        #ifndef _WIN64
          HWND hWnd = ( HWND ) hb_parnl( 1 );
       #else
          HWND hWnd = ( HWND ) hb_parnll( 1 );
       #endif

       _ms_lvi.iSubItem = hb_parnl( 3 );
       _ms_lvi.pszText = ( char * ) hb_parc( 4 );

       SendMessage( hWnd, LVM_SETITEMTEXT, hb_parnl( 2 ), ( LPARAM ) ( LV_ITEM * ) &_ms_lvi );
    }
















        #pragma ENDDUMP
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 10:15 AM
Antonio changed HB_FUNC( ILCREATE ) inside imagelis.c to create 32bit image lst.
<div class="c" id="{CB}" style="font-family: monospace;">HB_FUNC( ILCREATE )
{  
   InitImageList();
 
     #ifndef _WIN64
                                              // ILC_COLORDDB | ILC_MASK
      hb_retnl( ( LONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                ILC_MASK | ILC_COLOR32, 0, 50 ) );
   #else             
      hb_retnll( ( LONGLONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                ILC_MASK | ILC_COLOR32, 0, 50 ) );
   #endif
}</div>


If you dont' have the latest FiveWin you can add:
Code (fw): Select all Collapse
LOCAL oImageListBig := TImageList():New(32,32)
LOCAL oImageListSmall := TImageList():New(16,16)
oImageListBig:hImageList := Fix(32,32)
oImageListSmall:hImageList := Fix(16,16)


Regards,
Antonino
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 10:45 AM
but not run ok
I change imagelist.c
I have the fwh Rel.jannuary with last listview modified from Antonio

the code
Code (fw): Select all Collapse
    
# include "fivewin.ch"



    #define LVS_ICON              0
#define LVS_SMALLICON         2
#define LVS_LIST              3

    static oList
    static oImageList
    static oImageListBig
    static oImageListSmall

    Function test()
    Local oDlg
    local obtn[5]
    Define Dialog oDlg  size 400,400



    @ 1,10 button obtn[1] prompt " delete item" action  nil
    @ 10,10 button obtn[2] prompt " rename item" action  nil


    @ 8,10 button obtn[3] prompt "Big"   SIZE 35,10 action give_type(1)
    @ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action give_type(2)
    @ 8,25 button obtn[5] prompt "List"  SIZE 25,10 action nil


    activate dialog oDlg;
    ON INIT Crealistview(oDlg)
    return nil
    //----------------------------------------------------------------------//

Function give_type(n)

   Do Case
   case n=1
          oList:SetImageList(oImageListBig ,1)
          oList:SetImageList(oImageListSmall,0 )
       case n=2
          oList:SetImageList(oImageListBig ,0)
          oList:SetImageList(oImageListSmall,1 )
       endcase
       return nil

       
  //----------------------------------------------------------------------//


    Function Crealistview(oDlg)

       Local nOption     := 1
       local bAction:= { | nOption | Optionfile( oList ) }



       oImageList := TImageList():New(32,32)
       oImageList:hImageList := Fix(32,32)

       oImageListBig := TImageList():New(32,32)
       oImageListBig:hImageList := Fix(32,32)

       oImageListSmall := TImageList():New(16,16)
       oImageListSmall:hImageList := Fix(16,16)


       oList := TListView():New(oDlg:nHeight-300,2,{},bAction, oDlg, ,,.T., .F., oDlg:nwidth-25,150, )
       oList:SetImageList(oImageList)



       // toglie il dotted
       oList:WinStyle(/*LVS_SINGLESEL*/4,.T.)
       oList:lPopUp:= .f.






       DragAcceptFiles( oList:hWnd, .T. )
       oList:bDropFiles = {|nRow,nCol,aFiles| Drop(oList,oImageList,nRow,nCol,aFiles) }


     return nil





    Procedure Drop(oList,oImageList, nRow,nCol,aFiles)
       local cFile, nImage, oItem
       for each cFile in aFiles
          nImage := Icon_Read(cFile)
          //MSgInfo(cFile + STR(GetLastError()))
          //Aggiungi_record(cFile)
          nImage := max(0,ILADDICON( oImageList:hImageList, nImage ) )
          DestroyIcon(nImage)
          // oList:InsertItem(nImage, cFile, 0)
          oItem = TListViewItem():New( oList )
          oItem:cText = cFile
          oItem:nImage = nImage
          oItem:Create()
       next
    return





    function Optionfile(oList)

       Local nfile:= oList:nOption

       msginfo(str(oList:nOption))

       msginfo( oList:aItems[nFile]:cText )
    return nil



         #pragma BEGINDUMP
        #include <windows.h>
        #include <hbapi.h>
        #include <CommCtrl.h>

        HB_FUNC( FIX )
        {
           typedef HIMAGELIST ( __stdcall * PIMAGELIST_CREATE ) ( int cx, int cy,
                                UINT flags, int cInitial, int cGrow );
           static PIMAGELIST_CREATE pImageList_Create = NULL;

      if( pImageList_Create == NULL )
       {
          HMODULE hDLL = LoadLibrary( "comctl32.dll" );
          if( hDLL )
             pImageList_Create = ( PIMAGELIST_CREATE ) GetProcAddress( hDLL, "ImageList_Create" );
          FreeLibrary(hDLL);
       }

        #ifndef _WIN64
          hb_retnl( ( LONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                     ILC_MASK | ILC_COLOR32, 0, 50 ) );
        #else
           hb_retnll( ( LONGLONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                     ILC_MASK | ILC_COLOR32, 0, 50 ) );
        #endif
        }


        HB_FUNC( LVDELETEITEM )
    {
         #ifndef _WIN64
          HWND hWnd = ( HWND ) hb_parnl( 1 );
       #else
          HWND hWnd = ( HWND ) hb_parnll( 1 );
       #endif

       ListView_DeleteItem( hWnd, hb_parnl( 2 ) );
    }


      HB_FUNC( LVSETITEMTEXT )
    {
       LV_ITEM _ms_lvi;

        #ifndef _WIN64
          HWND hWnd = ( HWND ) hb_parnl( 1 );
       #else
          HWND hWnd = ( HWND ) hb_parnll( 1 );
       #endif

       _ms_lvi.iSubItem = hb_parnl( 3 );
       _ms_lvi.pszText = ( char * ) hb_parc( 4 );

       SendMessage( hWnd, LVM_SETITEMTEXT, hb_parnl( 2 ), ( LPARAM ) ( LV_ITEM * ) &_ms_lvi );
    }
















        #pragma ENDDUMP
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 11:00 AM
hi,
You are a little confused, the number as second parameter in SetImageList is the type of the list, and it can be setted one time only.
Maybe this code is more clear, add this at begin of file:
Code (fw): Select all Collapse
#define LVSIL_NORMAL          0
#define LVSIL_SMALL           1
#define LVSIL_STATE           2

then:
Code (fw): Select all Collapse
Function Crealistview(oDlg)

       Local nOption     := 1
       local bAction:= { | nOption | Optionfile( oList ) }

       oImageListBig := TImageList():New(32,32)
       oImageListBig:hImageList := Fix(32,32)

       oImageListSmall := TImageList():New(16,16)
       oImageListSmall:hImageList := Fix(16,16)


       oList := TListView():New(oDlg:nHeight-300,2,{},bAction, oDlg, ,,.T., .F., oDlg:nwidth-25,150, )
       oList:SetImageList(oImageListBig, LVSIL_NORMAL)
       oList:SetImageList(oImageListSmall, LVSIL_SMALL)


       // toglie il dotted
       oList:WinStyle(/*LVS_SINGLESEL*/4,.T.)
       oList:lPopUp:= .f.






       DragAcceptFiles( oList:hWnd, .T. )
       oList:bDropFiles = {|nRow,nCol,aFiles| Drop(oList,oImageList,nRow,nCol,aFiles) }


     return nil


change Drop procedure too:
Code (fw): Select all Collapse
    Procedure Drop(oList,oImageList, nRow,nCol,aFiles)
       local cFile, nImage, oItem
       for each cFile in aFiles
          nImage := Icon_Read(cFile)
          //MSgInfo(cFile + STR(GetLastError()))
          //Aggiungi_record(cFile)
          ILADDICON( oImageListSmall:hImageList, nImage )
          nImage := max(0,ILADDICON( oImageListBig:hImageList, nImage ) )
          DestroyIcon(nImage)
          // oList:InsertItem(nImage, cFile, 0)
          oItem = TListViewItem():New( oList )
          oItem:cText = cFile
          oItem:nImage = nImage
          oItem:Create()
       next
    return


here complete code:
Code (fw): Select all Collapse
   
# include "fivewin.ch"

#define LVSIL_NORMAL          0
#define LVSIL_SMALL           1
#define LVSIL_STATE           2

    #define LVS_ICON              0
#define LVS_SMALLICON         2
#define LVS_LIST              3

    static oList
    static oImageListBig
    static oImageListSmall

    Function test()
    Local oDlg
    local obtn[5]
    Define Dialog oDlg  size 400,400



    @ 1,10 button obtn[1] prompt " delete item" action  nil
    @ 10,10 button obtn[2] prompt " rename item" action  nil


    @ 8,10 button obtn[3] prompt "Big"   SIZE 35,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_ICON ) )
    @ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_SMALLICON ) )
    @ 8,25 button obtn[5] prompt "List"  SIZE 25,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_LIST ) )


    activate dialog oDlg;
    ON INIT Crealistview(oDlg)
    return nil
    //----------------------------------------------------------------------//
Function give_type(n)

   Do Case
   case n=1
          oList:SetImageList(oImageListBig ,1)
          oList:SetImageList(oImageListSmall,0 )
       case n=2
          oList:SetImageList(oImageListBig ,0)
          oList:SetImageList(oImageListSmall,1 )
       endcase
       return nil


    Function Crealistview(oDlg)

       Local nOption     := 1
       local bAction:= { | nOption | Optionfile( oList ) }

       oImageListBig := TImageList():New(32,32)
       oImageListBig:hImageList := Fix(32,32)

       oImageListSmall := TImageList():New(16,16)
       oImageListSmall:hImageList := Fix(16,16)


       oList := TListView():New(oDlg:nHeight-300,2,{},bAction, oDlg, ,,.T., .F., oDlg:nwidth-25,150, )
       oList:SetImageList(oImageListBig,LVSIL_NORMAL)
       oList:SetImageList(oImageListSmall,LVSIL_SMALL)



       // toglie il dotted
       oList:WinStyle(/*LVS_SINGLESEL*/4,.T.)
       //oList:= .f.






       DragAcceptFiles( oList:hWnd, .T. )
       oList:bDropFiles = {|nRow,nCol,aFiles| Drop(oList,nil,nRow,nCol,aFiles) }


     return nil





    Procedure Drop(oList,oImageList, nRow,nCol,aFiles)
       local cFile, nImage, oItem, imgIdx
       for each cFile in aFiles
          nImage := Icon_Read(cFile)
          //MSgInfo(cFile + STR(GetLastError()))
          //Aggiungi_record(cFile)
          ILADDICON( oImageListSmall:hImageList, nImage )
          nImage := max(0,ILADDICON( oImageListBig:hImageList, nImage ) )
          DestroyIcon(nImage)
          // oList:InsertItem(nImage, cFile, 0)
          oItem = TListViewItem():New( oList )
          oItem:cText = cFile
          oItem:nImage = nImage
          oItem:Create()
       next
    return





    function Optionfile(oList)

       Local nfile:= oList:nOption

       msginfo(str(oList:nOption))

       msginfo( oList:aItems[nFile]:cText )
    return nil



         #pragma BEGINDUMP
        #include <windows.h>
        #include <hbapi.h>
        #include <CommCtrl.h>

        HB_FUNC( FIX )
        {
           typedef HIMAGELIST ( __stdcall * PIMAGELIST_CREATE ) ( int cx, int cy,
                                UINT flags, int cInitial, int cGrow );
           static PIMAGELIST_CREATE pImageList_Create = NULL;

      if( pImageList_Create == NULL )
       {
          HMODULE hDLL = LoadLibrary( "comctl32.dll" );
          if( hDLL )
             pImageList_Create = ( PIMAGELIST_CREATE ) GetProcAddress( hDLL, "ImageList_Create" );
          FreeLibrary(hDLL);
       }

        #ifndef _WIN64
          hb_retnl( ( LONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                     ILC_MASK | ILC_COLOR32, 0, 50 ) );
        #else
           hb_retnll( ( LONGLONG ) pImageList_Create( hb_parnl( 1 ), hb_parnl( 2 ),
                     ILC_MASK | ILC_COLOR32, 0, 50 ) );
        #endif
        }


        HB_FUNC( LVDELETEITEM )
    {
         #ifndef _WIN64
          HWND hWnd = ( HWND ) hb_parnl( 1 );
       #else
          HWND hWnd = ( HWND ) hb_parnll( 1 );
       #endif

       ListView_DeleteItem( hWnd, hb_parnl( 2 ) );
    }


      HB_FUNC( LVSETITEMTEXT )
    {
       LV_ITEM _ms_lvi;

        #ifndef _WIN64
          HWND hWnd = ( HWND ) hb_parnl( 1 );
       #else
          HWND hWnd = ( HWND ) hb_parnll( 1 );
       #endif

       _ms_lvi.iSubItem = hb_parnl( 3 );
       _ms_lvi.pszText = ( char * ) hb_parc( 4 );

       SendMessage( hWnd, LVM_SETITEMTEXT, hb_parnl( 2 ), ( LPARAM ) ( LV_ITEM * ) &_ms_lvi );
    }
















        #pragma ENDDUMP
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 11:14 AM

thank now run ok
only when select the small icons is activated the dotted box

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 01:47 PM
:-) the code in viewtopic.php?f=3&t=1867&hilit=LVS_LIST#p7899 is not correct.

You can:
Code (fw): Select all Collapse
@ 8,10 button obtn[3] prompt "Big"   SIZE 35,10 action oList:WinStyle(LVS_LIST, .F.)
@ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action (oList:WinStyle(LVS_LIST, .F.), oList:WinStyle(LVS_SMALLICON, .T.))
@ 8,25 button obtn[5] prompt "List"  SIZE 25,10 action oList:WinStyle(LVS_LIST, .T.)


Or better:
Code (fw): Select all Collapse
#define LV_VIEW_ICON            0x0000
#define LV_VIEW_DETAILS         0x0001
#define LV_VIEW_SMALLICON       0x0002
#define LV_VIEW_LIST            0x0003
#define LV_VIEW_TILE            0x0004
#define LV_VIEW_MAX             0x0004

#define LVM_FIRST               0x1000      // ListView messages
#define LVM_SETVIEW         (LVM_FIRST + 142)

then:
Code (fw): Select all Collapse
@ 8,10 button obtn[3] prompt "Big"   SIZE 35,10 action oList:SendMsg(LVM_SETVIEW, LV_VIEW_ICON, 0)
@ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action oList:SendMsg(LVM_SETVIEW, LV_VIEW_SMALLICON, 0)
@ 8,25 button obtn[5] prompt "List"  SIZE 25,10 action oList:SendMsg(LVM_SETVIEW, LV_VIEW_LIST, 0)

but in this case "you must provide a manifest specifying Comctl32.dll version 6.0".

Regards,
Antonino

PS. theoretically you can do:
Code (fw): Select all Collapse
@ 8,10 button obtn[3] prompt "Big"   SIZE 35,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_ICON,/*LVS_SINGLESEL*/4 ) )
@ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_SMALLICON,/*LVS_SINGLESEL*/4 ) )
@ 8,25 button obtn[5] prompt "List"  SIZE 25,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_LIST,/*LVS_SINGLESEL*/4 ) )
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: popup on Listview class
Posted: Mon Jun 22, 2015 02:20 PM

Antonino,

Many thanks for your great help :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: popup on Listview class
Posted: Tue Jun 23, 2015 03:11 PM

for the version of bcc and fwh I have seem run ok only these lines

@ 8,10 button obtn[3] prompt "Big" SIZE 35,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_ICON,/LVS_SINGLESEL/4 ) )
@ 8,18 button obtn[4] prompt "Small" SIZE 35,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_SMALLICON,/LVS_SINGLESEL/4 ) )
@ 8,25 button obtn[5] prompt "List" SIZE 25,10 action SetWindowLong( oList:hWnd, -16, nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_LIST,/LVS_SINGLESEL/4 ) )

I don't why ...

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion