Announcement

Collapse
No announcement yet.

Function or Subclass? Pass CB collection to a function or sub.

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

  • Function or Subclass? Pass CB collection to a function or sub.

    I have been working on a function that moves the code for a %WM_DRAWITEM to a separate place for clarity and space.

    Is there a way to send the collection of CB. values (CB.HNDL etc) as a single value? Was wondering if there is a CB structure??

    I know I could just pass the values I need FUNCTION FUN_NAME (CB_HANDLE AS LONG, CB.LPARAM AS LONG etc...)

    Should this actually be a SUBCLASS??

    Basically I am trying to make a LISTBOX where I can pick the background color for each row...

    Actually a VIRTUAL LISTBOX where the row data array has multiple columns like RowText and RowColor.

    I guess I am trying to make a grid (listview?) where I can control the colors of each cell....

    Perhaps a VIRTUAL LISTVIEW..?? Where owner draw would let me color each cell...

  • #2
    After looking in Help where says the CB dot items are functions, I figured
    Code:
    type MyCBtype
      hndl as dword
      msg  as long
      wparam as long
      lparam as long
    end type
    callback function MyDlgCB() as long
      local The_CB as MyCBtype
      The_CB.hndl = cb.hndl
      The_CB.msg  = cb.msg
      The_CB.wparam = cb.wparam
      The_CB.lparam = cb.lparam
      select case as long cb.msg
        case ...
          MakeMyListbox The_CB
    ...
    end function
    sub MakeMyListbox(byref CurCB as MyCBtype)
    ...
    At least it is one variable to pass versus four.

    Cheers,
    Last edited by Dale Yarker; 5 Dec 2018, 10:18 PM.
    Dale

    Comment


    • #3
      You have a point there Dale!

      Comment


      • #4
        Hey Dale!
        That's quite original. I don't think I've seen that before!

        Comment


        • #5
          Originally posted by David Clarke View Post
          I have been working on a function that moves the code for a %WM_DRAWITEM to a separate place for clarity and space.

          Is there a way to send the collection of CB. values (CB.HNDL etc) as a single value? Was wondering if there is a CB structure??
          Had you considered using a GOSUB/RETURN within the CALLBACK itself?
          The world is strange and wonderful.*
          I reserve the right to be horrifically wrong.
          Please maintain a safe following distance.
          *wonderful sold separately.

          Comment


          • #6
            That is a good idea too Kurt!

            Comment

            Working...
            X