Hi Staffan,

Here is an example program that is probably about as good as you can get
with the current ooDialog.

Each window in Windows has its own cursor shape.  When the cursor is over
the window, the window switches the cursor to its shape.  So when the
cursor is over the Header control, it swtiches the cursor to its shape.
 When the cursor is over the list-view, the list-view switches the cursor
to its shape.

This example moves the cursor over the list-view and sets the cursor to the
Wait shape.  It sets a flag  so that it knows when it is sorting and when
it is not.  On a column click, if it is sorting it moves the cursor back
over the list-view so that the Wait cursor shows and returns.  If it is not
sorting, then it starts a sort.

The ideal thing would be to be able to get the Header control and change
its cursor shape.  But, not possible to do that in the current ooDialog.
 Some lines may wrap in the code below:

/*
 *  Simple List View control using ooDialog.
 */

  dlg = .SimpleLV~new
  if dlg~initCode = 0 then do
    dlg~create(30, 30, 325, 200,     -
               "A Simple List View", -
               "VISIBLE")

    dlg~execute("SHOWTOP")
  end

-- End of entry point.

::requires "ooDialog.cls"

::class 'SimpleLV' subclass UserDialog

::method defineDialog

  self~addListControl(100, lControlData,       -
                      10, 20, 305, 145,        -
                      "REPORT SHOWSELALWAYS");

  self~addButton(IDOK, 280, 175, 35, 15, -
                 "Close", , "DEFAULT")

  self~connectListViewEvent(100, "COLUMNCLICK", onColumnClick)

::method initDialog
  expose list lvMouse sorting

  sorting = .false

  list = self~newListView(100)

  columnNames = .array~of("Line", "Number")
  list~addExtendedStyle("FULLROWSELECT GRIDLINES"    -
                        "CHECKBOXES HEADERDRAGDROP")

  list~InsertColumn(0, "Row (Column 1)", 95)
  list~InsertColumn(1, "Column 2", 95)
  list~InsertColumn(2, "Column 3", 95)

  do i = 1 to 200
    list~addRow(i, , "Line" i, "Column" 2, "Column" 3)
  end

  lvMouse = .Mouse~new(list)

::method onColumnClick unguarded
  expose list lvMouse sorting oldCursor
  use arg id, columnIndex

  -- Compensate for zero-based indexes ;-(
  columnIndex += 1
  say 'onClick() column:' columnIndex

  oldCursorPos = lvMouse~getCursorPos
  newCursorPos = oldCursorPos~copy
  newCursorPos~incr( , 25)

  if sorting then do
    -- Move the cursor back over the list view
    -- so that the wait cursor is showing
    lvMouse~setCursorPos(newCursorPos)
    return 0
  end

  reply 0


  -- Set the list view cursor to the busy symbol and
  -- move the mouse over the list view, so it repaints
  -- and we actually get the wait cursor.
  oldCursor = lvMouse~setCursor("WAIT")
  lvMouse~setCursorPos(newCursorPos)
  self~sortColumn(columnIndex)



::method sortColumn unguarded
  expose sorting oldCursor oldCursorPos lvMouse
  use strict arg colIndex

  reply 0

  sorting = .true
  do  4
    if \ self~isDialogActive then leave
    say 'Sorting column' colIndex
    j = SysSleep(1.5)
  end
  say 'Done sorting column' colIndex

  sorting = .false
  lvMouse~setCursor(oldCursor)
  pos = lvMouse~getCursorPos
  pos~incr
  lvMouse~setCursorPos(pos)


--
Mark Miesfeld
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to