Announcement

Collapse
No announcement yet.

LISTVIEW SET COLUMN -2 and -1

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

  • LISTVIEW SET COLUMN -2 and -1

    'LISTVIEW FIT CONTEXT and LISTVIEW SET COLUMN adjust
    'the columns widths after the listview is filled. Tried using
    'LiSTVIEW SET COLUMN with -1 and -2 options and get no column widths.
    Code:
    FOR col = 1 TO ColumnCount   'fit columns
        LISTVIEW FIT CONTENT hDlg, %LISTVIEW, col
        LISTVIEW FIT HEADER  hDlg, %LISTVIEW, col
        'LISTVIEW SET COLUMN hDlg, %LISTVIEW, col&, -2
      NEXT
    How long is an idea? Write it down.

  • #2
    ..
    Last edited by Mike Doty; 16 Oct 2008, 12:11 PM.
    How long is an idea? Write it down.

    Comment


    • #3
      The LISTVIEW SET COLUMN statment using a -1 or -2 is working for me
      Code:
      #COMPILE EXE
      #DIM ALL
      
      FUNCTION PBMAIN () AS LONG
        LOCAL hDlg  AS LONG
        LOCAL i     AS LONG
        LOCAL j     AS LONG
      
        DIALOG NEW 0, "Dialog1", , , 300, 125, TO hDlg
        CONTROL ADD LISTVIEW, hDlg, 1000, "", 5, 18, 290, 75
        CONTROL ADD BUTTON, hDlg, 1001, "Use -1", 1 ,1, 50, 14
        CONTROL ADD BUTTON, hDlg, 1002, "Use -2", 60 ,1, 50, 14
      
        FOR i= 1 TO 4
          LISTVIEW INSERT COLUMN hDlg, 1000, i, "Column #"+FORMAT$(i), 100, 0
        NEXT i
      
        FOR i=1 TO 4
          LISTVIEW INSERT ITEM hDlg, 1000, i, 0, "Item #1"
          FOR j = 2 TO 4
            LISTVIEW SET TEXT    hDlg, 1000, i, j, "Item #"+FORMAT$(j)
          NEXT j
        NEXT i
      
        DIALOG SHOW MODAL hDlg, CALL DlgProc
      END FUNCTION
      
      CALLBACK FUNCTION DlgProc
        LOCAL i AS LONG
      
        SELECT CASE AS LONG CB.MSG
          CASE %WM_COMMAND
            SELECT CASE AS LONG CB.CTL
              CASE 1001
                FOR i=1 TO 4
                  LISTVIEW SET COLUMN CB.HNDL, 1000, i, -1
                NEXT i
              CASE 1002
                FOR i=1 TO 4
                  LISTVIEW SET COLUMN CB.HNDL, 1000, i, -2
                NEXT i
            END SELECT
      
        END SELECT
      END FUNCTION
      Sincerely,

      Steve Rossell
      PowerBASIC Staff

      Comment


      • #4
        Both -1 and -2 wipeout the data inside the listview using XP SP3 using your code.
        How long is an idea? Write it down.

        Comment


        • #5
          Vista Home Premium and the results also get erased within the listview.
          How long is an idea? Write it down.

          Comment


          • #6
            Hi Mike,

            That would be because I am using a beta copy of 9.01. I tested this with 9.0 and you are correct the data items are being deleted.

            The free update to 9.01 will be available soon and no I do not know the date of the release (sorry).
            Sincerely,

            Steve Rossell
            PowerBASIC Staff

            Comment


            • #7
              LISTVIEW SET COLUMN -2 and -1

              I agree with Mike it does not work.
              Running your posted code here deletes each column using either the -1 or -2 button.

              Code:
              LISTVIEW SET COLUMN CB.HNDL, 1000, 3, -1
              Deletes column 3
              Trento Castricone
              www.fileraptor.com
              [email protected]

              Comment


              • #8
                Hi Mike,

                That would be because I am using a beta copy of 9.01. I tested this with 9.0 and you are correct the data items are being deleted.

                The free update to 9.01 will be available soon and no I do not know the date of the release (sorry).
                Ooooh, oooooh.....Mr. Kot-TairRRRRrrreee
                I guess now is a good time for Feature requests, and possible "Bug" fixes (not fake bugs, but bugs that proved to be real?) kinda thing????

                By the way...how do you sign up to become a beta-tester? (Pb is sooooo good that I actually find myself wanting to beta-test instead of leaving it up to people that miss "That lil something", that I find in most products )
                Engineer's Motto: If it aint broke take it apart and fix it

                "If at 1st you don't succeed... call it version 1.0"

                "Half of Programming is coding"....."The other 90% is DEBUGGING"

                "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                Comment


                • #9
                  Mike, I just tried Scott's code too with Vista Ultimate, and it wiped everything out. (Both for -1 and -2)

                  Gut Instinct is telling me I am onto something here (without even looking at how a ListView works), but have to ask "Why -2?" (like I said "Instinct" and just going by odd posts in my head) as -1 should hide a column (but thinking -2 has something to do with DDT vs SDK ???

                  Anyways I could be WAYYYY off here cause a 5 second lookup of "ListView SET" led me to a new compiler keyword.

                  Hmmm back to the docs
                  Engineer's Motto: If it aint broke take it apart and fix it

                  "If at 1st you don't succeed... call it version 1.0"

                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                  Comment

                  Working...
                  X