On Fri, Jan 11, 2013 at 5:50 PM, Mark Miesfeld <miesfeld@gmail.com> wrote:

It appears it can't be done with the labletip.  My guess is that the list-view, which owns the tool tip control, resets the tool tip's parameters right before it shows the tip each time


Here is a simple test program that shows the list-view must be resetting the max width right before it shows the label tip.

In initDialog() the tool tip for the list-view is gotten.  The current max width is displayed and then it is set to 45.  There is only one place where the label tip is shown, so it is easy to control when it is shown.

When you push the Test 1 button, the current max width for the tool tip is displayed again.  If you start the dialog and don't move the mouse over the one column where the label tip is, and press the Test 1 button, you will see the current width is still 45.  Every time you press the button the current width is reset to 45.

Then you can play around with it by moving over the one place where the label tip is displayed and pushing the test button.

Every time the label is displayed, the current max width has been changed back to -1.

So, it is apparent that the list-view must reset the max width every time before it displays the label tip.

/* Simple ListView using ooDialog */

  dlg = .SimpleLV~new
  if dlg~initCode = 0 then do
    dlg~create(30, 30, 350, 200, "The Simple ListView", "VISIBLE")
    dlg~execute("SHOWTOP")
  end

-- End of entry point.

::requires "ooDialog.cls"

::class 'SimpleLV' subclass UserDialog

::method defineDialog

  self~createListView(100, 10, 10, 330, 155, "REPORT");

  self~createPushButton(110, 125, 175, 50, 15, , "Special", onSpecial)
  self~createPushButton(120, 180, 175, 50, 15, , "Test1", onTest1)
  self~createPushButton(130, 235, 175, 50, 15, , "Test2", onTest2)
  self~createPushButton(IDOK, 290, 175, 50, 15, "DEFAULT", "Close", close)


::method initDialog
  expose list columnNames toolTip

  list = self~newListView(100)

  list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP SUBITEMIMAGES LABELTIP")

  list~InsertColumn(0, "Line text", 75)
  list~InsertColumn(1, "Line number", 55)
  list~InsertColumn(2, "Numbers", 55)

  rows = self~insertRows(list)

  toolTip = list~getToolTips
  ret = toolTip~setMaxTipWidth(45)
  say 'max width was:' ret
  say 'width now:    ' toolTip~getMaxTipWidth
  say 'tool count    ' toolTip~getToolCount
  do i = 1 to toolTip~getToolCount
    toolInfo = toolTip~enumTools(i)
    say 'Tool info hwnd:    ' toolInfo~rexxHwnd~hwnd
    say 'Tool info id:      ' toolInfo~rexxID
    say 'Tool info text:    ' toolInfo~text
    say 'Tool info flags:   ' toolInfo~flags
    say 'Tool info rect:    ' toolInfo~rect
    say 'Tool info userData:' toolInfo~userData
    say 'Tool info resource:' toolInfo~resource
    say
  end

  list~setItemText(1, 2, "Very long text to see what we can see when we see it")


::method onSpecial
  expose list toolTip
  say 'onSpecial(), no atction now.'


::method onTest1 unguarded
  expose list toolTip

  say 'width now:' toolTip~getMaxTipWidth
  say 'tool count' toolTip~getToolCount
  do i = 1 to toolTip~getToolCount
    toolInfo = toolTip~enumTools(i)
    say 'Tool info hwnd:    ' toolInfo~rexxHwnd~hwnd
    say 'Tool info id:      ' toolInfo~rexxID
    say 'Tool info text:    ' toolInfo~text
    say 'Tool info flags:   ' toolInfo~flags
    say 'Tool info rect:    ' toolInfo~rect
    say 'Tool info userData:' toolInfo~userData
    say 'Tool info resource:' toolInfo~resource
    say
  end

  say 'Setting max width to 45 again.'
  toolTip~setMaxTipWidth(45)


::method onTest2 unguarded
  expose list toolTip
  say 'onTest2(), no action now'

::method insertRows private
  use arg list

  --countRows = 10000
  countRows = 10
  rows = .array~new(countRows)

  do i = 1 to countRows
    j = i - 1
    j = 0
    lvi = .LvItem~new( j, 'Line' i, , p)
    lvsi1 = .LvSubItem~new(i, 1, i)
    lvsi2 = .LvSubItem~new(i, 2, random(1, 200))

    r = .LvFullRow~new(lvi, lvsi1, lvsi2, .true)
    list~addFullRow(r)
    rows[i] = r
  end

  return rows

--
Mark Miesfeld