Announcement

Collapse
No announcement yet.

Missing DDT LISTVIEW Samples

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Missing DDT LISTVIEW Samples

    There appears to be no samples using the new DDT Listview command set.

    Am I missing something in my install?
    <b>George W. Bleck</b>
    <img src='http://www.blecktech.com/myemail.gif'>

  • #2
    Preliminary Listview Experiment

    I was fooling around with the LISTVIEW statements yesterday, hoping to put together a simple data entry grid, and discovered that I'm going to have to research owner drawn controls to get all the effects I want. But, here's some sample code that might help you get a toe-hold on using the listview statements to display columns of data. It's nice that the scroll bars are added automatically.

    Code:
    'Testing Listview statments in PBWin 9.0
    '===================================================================================================
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "WIN32API.INC"
    '**********************  You need to include the following file for the
    '                        SET LISTVIEW STYLE statements to compile:
    #INCLUDE "CommCtrl.INC"
    '-----------------------------------------------------------------------------------------
    %IdForm       = 200
    %IdListView1  = 20001
    %left         = 0
    %right        = 1
    %center       = 2
    '===================================================================================================
    FUNCTION PBMAIN () AS LONG
      LOCAL hForm       AS DWORD
      LOCAL FormX       AS DWORD
      LOCAL FormY       AS DWORD
      LOCAL FormWide    AS DWORD
      LOCAL FormHigh    AS DWORD
      LOCAL FormStyleN  AS DWORD
      LOCAL FormStyleX  AS DWORD
      LOCAL ViewStyleN  AS DWORD
      LOCAL ViewStyleX  AS DWORD
      LOCAL I           AS DWORD
      LOCAL LV1RowCount AS DWORD
      LOCAL FontBodyN   AS DWORD
      LOCAL FontBodyI   AS DWORD
      LOCAL FontBodyB   AS DWORD
      LOCAL FontBodyX   AS DWORD
      LOCAL FontHeadB   AS DWORD
    '-----------------------------------------------------------------------------------------
    START_:
      GOSUB CreateFontHandles
      GOSUB CreateFormWindow
      GOSUB BuildTestListview
      GOSUB BuildFormButtons
      DIALOG SHOW MODAL hForm, CALL FormProcCallback
      GOSUB DestroyFontHandles
    CEASE_:
      EXIT FUNCTION
    '-----------------------------------------------------------------------------------------
    CreateFormWindow:
      FormX      = 0
      FormY      = 0
      FormWide   = 400
      FormHigh   = 250
      FormStyleN = %WS_CAPTION OR %WS_SYSMENU
      FormStyleX = 0
      ViewStyleN = %WS_TABSTOP OR %LVS_REPORT OR %LVS_SHOWSELALWAYS OR %LVS_EDITLABELS
      DIALOG NEW 0, "Sample Listview",,, FormWide, FormHigh, FormStyleN, FormStyleX TO hForm
      RETURN
    '-----------------------------------------------------------------------------------------
    BuildFormButtons:
      CONTROL ADD BUTTON, hForm, %IDCANCEL, "&Cancel", 340, 10, 50, 14
      RETURN
    '-----------------------------------------------------------------------------------------
    BuildTestListview:
      CONTROL ADD LISTVIEW,  hForm, %IdListView1, $NUL, 10, 40, 380, 200, ViewStyleN
      CONTROL SET FONT       hForm, %IdListView1, FontBodyB
      LISTVIEW INSERT COLUMN hForm, %IdListView1, 1, "Col 1",  50, %left   ' according to the documentation the
                                                                           ' justification of the first column
                                                                           ' is ALWAYS left, no matter what
                                                                           ' you specify or desire. Thanks, M$
      LISTVIEW INSERT COLUMN hForm, %IdListView1, 2, "Col 2",  50, %right
      LISTVIEW INSERT COLUMN hForm, %IdListView1, 3, "Col 3", 100, %center
      LISTVIEW INSERT COLUMN hForm, %IdListView1, 4, "Col 4", 300, %left
      CONTROL SET FONT       hForm, %IdListView1, FontBodyB                ' This sets the font for the whole
                                                                           ' listview table, including the headers,
                                                                           ' and overrides any previous
                                                                           ' control set font statements
      LV1RowCount = 100
      FOR I = 1 TO LV1RowCount
        LISTVIEW INSERT ITEM hForm, %IdListView1, I, 0, STR$( I )
        LISTVIEW SET TEXT    hForm, %IdListView1, I, 2, STR$( I )
        LISTVIEW SET TEXT    hForm, %IdListView1, I, 4, STR$( I )
      NEXT I
    '**********
    ' Try uncommenting the following line for an unexpected result
    '  LISTVIEW DELETE COLUMN hForm, %idListView1, 1
    '**********
    ' Hide column 1 instead...
      LISTVIEW SET COLUMN    hForm, %IdListView1, 1, 0
      LISTVIEW SET STYLE     hForm, %IdListView1, %LVS_EX_GRIDLINES OR %LVS_EX_ONECLICKACTIVATE
      RETURN
    '-----------------------------------------------------------------------------------------
    CreateFontHandles:
      FONT NEW "Calibri",  12, 0 TO FontBodyN
      FONT NEW "Calibri",  12, 2 TO FontBodyI
      FONT NEW "Calibri",  12, 1 TO FontBodyB
      FONT NEW "Calibri",  12, 3 TO FontBodyX
      FONT NEW "Consolas", 12, 0 TO FontHeadB
      RETURN
    '-----------------------------------------------------------------------------------------
    DestroyFontHandles:
      FONT END FontHeadB
      FONT END FontBodyX
      FONT END FontBodyB
      FONT END FontBodyI
      FONT END FontBodyN
      RETURN
    '-----------------------------------------------------------------------------------------
    END FUNCTION
    '+==================================================================================================
    CALLBACK FUNCTION FormProcCallback() AS LONG
      SELECT CASE AS LONG CB.MSG
      CASE %WM_INITDIALOG
        GOSUB ProcessInitializeMessage
      CASE %WM_COMMAND
        GOSUB ProcessControlMessage
      END SELECT
      EXIT FUNCTION
    '-----------------------------------------------------------------------------------------
    ProcessInitializeMessage:
      RETURN
    '-----------------------------------------------------------------------------------------
    ProcessControlMessage:
      SELECT CASE AS LONG CB.CTL
      CASE %IDCANCEL
        DIALOG END CB.HNDL, 0
      END SELECT
      RETURN
    '-----------------------------------------------------------------------------------------
    END FUNCTION
    Last edited by Blaise Wrenn; 27 Aug 2008, 04:15 PM. Reason: format

    Comment


    • #3
      LISTVIEW SET IMAGELIST trouble

      Thanks for the sample... I'm trying to put an icon image in one cell using LISTVIEW SET IMAGELIST and so on... Well, no luck...

      Do you know (or someone else) the right way?
      Gustavo Asplanatti
      gustavoa at computecsrl.com.ar

      Comment


      • #4
        Did a quick search and found this..

        C:\PBWin90\Samples\Ddt\Toolbar\Toolbar.bas"(98,3):
        Code:
         
        CONTROL ADD LISTVIEW,  hDlg, %ID_LISTVIEW, "", 0, 0, 0, 0, %WS_VISIBLE OR %WS_TABSTOP OR %LVS_ICON OR %LVS_SHOWSELALWAYS OR %LVS_SINGLESEL
        It sems to have all you need - LISTVIEW SET IMAGELIST etc.

        PS. While playing around with the toolbar.rc file I found that one of the icons is missing "301 icon icons\pdis.ico".
        Substituting "301 icon icons\pnorm.ico" stops the Resource compiler complaining
        Last edited by Dave Biggs; 2 Oct 2008, 09:01 AM. Reason: more info
        Rgds, Dave

        Comment


        • #5
          >I'm trying to put an icon image in one cell using LISTVIEW SET IMAGELIST and so on

          Since you say "cell" I can only assume ('and so on' not shown) you are using the listview control in Report View. In report view listview controls support one image per item (row), not one image per subitem (column).

          So I guess the answer is, you can't assign an image to a 'cell.'
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            See the FileFind sample. It contains the listview control using DDT.
            Scott Slater
            Summit Computer Networks, Inc.
            www.summitcn.com

            Comment

            Working...
            X