INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Browsers & ListBoxes

How to Mark or Multiple selection on a Listbox??? by Gaudalier
Posted: 5 Mar 02 (Edited 5 Mar 02)

Well, One of the most commun task of list controls is to be used to multiple selection, and somehow Clarion default behavior, guess what??? DOES NOT WORK according to the Windows Standards.

We're Lucky, there is a free template that solve ours existencial problem out there; just take a look at the DAS_TagUse Use Tags to Select Records from the TinMan Development Corp http://www.thetingroup.com/ This Template is usefull when we are taggin a Browse based on a Table (Default ABC/Legacy Templates)

But that TAG template is Useless when we try to tag a list wich Queue was manually loaded by ourself, I mean, HandCoding List.

So, Here is the code I've use to show the Archives within a Zip File. Using the excellent library of BigSpeed Zip Dll from www.bigSpeed.com

First. We have a List populated Without using the default template. This list will be based on a Queue declarated like this:

ZipQueue   QUEUE,PRE(ZIP)
Name         CSTRING(256) !Name of the File
Ext          CSTRING(4)   !File's Extension
Modified     CSTRING(20)  !Time/Date Stamp
Size         LONG         !Total File's size
Packed       LONG         !Packed File's size
Ratio        BYTE         !% of compresion
Path         CSTRING(256) !Relative Path (if any)
Index        LONG         !Position within the zip Archive
Mark         BYTE         !To be use in Mark Attrib.
           END

Rememeber that the Queue will hold information about the Files of a Zip Archive.

Well, once we'd put the LIST control in the window and choose the option "populate control Without control template" when the "Select control to use" Windows popups. After that, popups the Window "Select Column", we go to LOCAL DATA and select the ZIP:Name field from the QUEUE ZipQueue, repeat the step for every field until the ZIP:Path.

Then we need to change the default "FROM" List's property from "List1:Queue" to our local Queue "ZipQueue", and fill in the "MARK" field with "ZIP:Mark", this last is located in the "Extra" Tab.

Finally we need to add serveral "ALERT" on the list:

CtrlA
MouseLeft
DownKey
UpKey
ShiftLeftMouse
ShiftUp
ShiftDown
CtrlDown
CtrlUp

The Default Clarion's mark behavior is simple, you tag a record by Cliking on it, to uncheck you need to click again.

If you try the windows default check/uncheck behavior like Exporer, will note that:
1. A simple click Untag All Selected Records but the one Clicked.
2. Arrow Up/down does the same like a simple Click.
3. ShiftClick will select from the last selected to the one we'd clicked on.
4. ShiftDown/up  will goes marking selected every record as we press ShiftDown key secuence.
5. CtrlClick will tag the record altrough it not on secuential order.
6. CtrlDown/up will do like CtrlClick, but if we wanna mark a record we must to press SPACE bar to TOGGLE marked/unmarked evey record.

Ok. this is the Code:

At PreAlertKey Embed, priority 2500:


CASE KEYCODE()
  OF MOUSELEFT  !**********  MOUSE CLICK
    IF RECORDS(ZipQueue)
      J# =  ?List{PropList:MouseDownRow}
      LOOP I# = 1 TO RECORDS(ZipQueue)
        GET(ZipQueue,I#)
        ZIP:Mark = FALSE
        PUT(ZipQueue)
      END
      GET(ZipQueue,J#)
      ZIP:Mark = TRUE
      PUT(ZipQueue)
      SELECT(?List,J#)
    END
     RETURN(0)

   OF CTRLDOWN  !********** CONTROL+DOWN
    IF CHOICE(?List) <> RECORDS(ZipQueue)
      GET(ZipQueue,CHOICE(?List)+1)
    ELSE
      GET(ZipQueue,RECORDS(ZipQueue))
    END
     RETURN(0)

   OF CTRLUP    !********** CONTROL+UP
    IF CHOICE(?List) <> 1
      GET(ZipQueue,CHOICE(?List)-1)
    ELSE
      GET(ZipQueue,1)
    END
     RETURN(0)
END



And at AlertKey Embed, priority 2500:



CASE KEYCODE()
  OF UPKEY          !************* UPKEY  (48)
    IF CHOICE(?List) <> 1
      LOOP I# = 1 TO RECORDS(ZipQueue)
        GET(ZipQueue,I#)
        ZIP:Mark = FALSE
        PUT(ZipQueue)
      END
      GET(ZipQueue,CHOICE(?List)-1)
      ZIP:Mark = TRUE
      PUT(ZipQueue)
      SELECT(?List,CHOICE(?List)-1)
    END
  OF DOWNKEY          !************* DOWNKEY  (40)
    IF CHOICE(?List) <> RECORDS(ZipQueue)
      LOOP I# = 1 TO RECORDS(ZipQueue)
        GET(ZipQueue,I#)
        ZIP:Mark = FALSE
        PUT(ZipQueue)
      END
      GET(ZipQueue,CHOICE(?List)+1)
      ZIP:Mark = TRUE
      PUT(ZipQueue)
      SELECT(?List,CHOICE(?List)+1)
    END
  OF SHIFTMOUSELEFT   !************ MOUSE CLICK (257)
    IF ?List{PropList:MouseDownRow} > CHOICE(?List)
      FromHere# = CHOICE(?List)
      ToHere# = ?List{PropList:MouseDownRow}
      J# = ToHere#
    ELSE
      ToHere# = CHOICE(?List)
      FromHere# = ?List{PropList:MouseDownRow}
      J# = FromHere#
    END
    LOOP I# = 1 TO RECORDS(ZipQueue)
      GET(ZipQueue,I#)
      ZIP:Mark = INRANGE(I#,FromHere#,ToHere#)
      PUT(ZipQueue)
    END
    SELECT(?List,J#)

  OF SHIFTUP        !************* SHIFT + UP (294)
    IF CHOICE(?List) <> 1
      GET(ZipQueue,CHOICE(?List)-1)
      ZIP:Mark = TRUE
      PUT(ZipQueue)
      SELECT(?List,CHOICE(?List)-1)
    END

  OF SHIFTDOWN        !************* SHIFT DOWN (296)
    IF CHOICE(?List) <> RECORDS(ZipQueue)
      GET(ZipQueue,CHOICE(?List)+1)
      ZIP:Mark = TRUE
      PUT(ZipQueue)
      SELECT(?List,CHOICE(?List)+1)
    END

  OF CTRLUP      !************* CONTROL+UP  (550)
    IF CHOICE(?List) <> 1
      SELECT(?List,CHOICE(?List)-1)
      IF ZIP:Mark = FALSE
        PRESSKEY(SPACEKEY)
      END
    END

  OF CTRLDOWN      !************* CONTROL+DOWN  (552)
    IF CHOICE(?List) <> RECORDS(ZipQueue)
      SELECT(?List,CHOICE(?List)+1)
      IF ZIP:Mark = FALSE
        PRESSKEY(SPACEKEY)
      END
    END

  OF CTRLA            !************* CONTROL+A  (577)
    LOOP I# = 1 TO RECORDS(ZipQueue)
      GET(ZipQueue,I#)
      ZIP:Mark = TRUE
      PUT(ZipQueue)
    END
END



Finally I mention that the List has checked the "Hide Selection" property.

This Code Was Improved with a ROUTINE that Clears the ZIP:Mark on the Whole Queue. But I'd pretend to show the simplest way to mark the List.

REGARDS

Back to SoftVelocity: Clarion solutions FAQ Index
Back to SoftVelocity: Clarion solutions Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close