popup on Listview class

popup on Listview class

Postby Silvio.Falconi » Sat Jun 20, 2015 3:17 pm

I made the popup menu for Listview
I hope Antonio insert it on new release of this class


add new defines

Code: Select all  Expand view  RUN
#define LVS_ICON                  0
#define LVS_SMALLICON         2
#define LVS_LIST                  3

 



add new data
Code: Select all  Expand view  RUN
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: Select all  Expand view  RUN
IF ::lPopUp
      ::bRCliCked := {| nRow, nCol, nKey | ::PopMenu( nRow, nCol, nKey ) }
   ENDIF





Popup method

Code: Select all  Expand view  RUN
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 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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: popup on Listview class

Postby Silvio.Falconi » Mon Jun 22, 2015 8: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 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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: popup on Listview class

Postby AntoninoP » Mon Jun 22, 2015 9:58 am

You should create 2 imageListes, one for big icons and one for small icons, like:
Code: Select all  Expand view  RUN
LOCAL oImageListBig := TImageList():New(32,32)
LOCAL oImageListSmall := TImageList():New(16,16)

Then call
Code: Select all  Expand view  RUN
oList:SetImageList(oImageListBig ,0)
oList:SetImageList(oImageListSmall,1 )

Regards,
Antonino
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: popup on Listview class

Postby Silvio.Falconi » Mon Jun 22, 2015 10:10 am

not run

test.prg

Code: Select all  Expand view  RUN
 

  # 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

 
Last edited by Silvio.Falconi on Mon Jun 22, 2015 10:38 am, edited 1 time in total.
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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: popup on Listview class

Postby AntoninoP » Mon Jun 22, 2015 10:15 am

Antonio changed HB_FUNC( ILCREATE ) inside imagelis.c to create 32bit image lst.
Code: Select all  Expand view  RUN
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
}


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


Regards,
Antonino
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: popup on Listview class

Postby Silvio.Falconi » 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: Select all  Expand view  RUN
   
# 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 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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: popup on Listview class

Postby AntoninoP » 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: Select all  Expand view  RUN
#define LVSIL_NORMAL          0
#define LVSIL_SMALL           1
#define LVSIL_STATE           2

then:
Code: Select all  Expand view  RUN
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: Select all  Expand view  RUN
   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: Select all  Expand view  RUN
 
# 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:lPopUp:= .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

 
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: popup on Listview class

Postby Silvio.Falconi » 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 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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: popup on Listview class

Postby AntoninoP » Mon Jun 22, 2015 1:47 pm

:oops: the code in viewtopic.php?f=3&t=1867&hilit=LVS_LIST#p7899 is not correct.

You can:
Code: Select all  Expand view  RUN
@ 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: Select all  Expand view  RUN
#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: Select all  Expand view  RUN
@ 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: Select all  Expand view  RUN
@ 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 ) )
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: popup on Listview class

Postby Antonio Linares » Mon Jun 22, 2015 2:20 pm

Antonino,

Many thanks for your great help :-)
regards, saludos

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

Re: popup on Listview class

Postby Silvio.Falconi » Tue Jun 23, 2015 3: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 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: 7063
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 48 guests