>Is there a property command that will move entries up and down in a
>listbox?

copy this code, click on the demo form and select paste, then run the form and
test it.  It moves 1 or more items up 1 in the list...

object EnhancedSpeedButton2: TEnhancedSpeedButton
  Left = 220
  Top = 310
  Width = 77
  Height = 42
  Caption = 'Move 1 Selected Item Up the List'
  HotTrackFont.Charset = DEFAULT_CHARSET
  HotTrackFont.Color = clWindowText
  HotTrackFont.Height = -11
  HotTrackFont.Name = 'MS Sans Serif'
  HotTrackFont.Style = [fsUnderline]
  NumGlyphs = 1
  WordWrap = True
  EEPNum = -1
  CustomEEP.Strings = (
    'SET VAR vcnt = NULL'
    'SET VAR vtext TEXT = NULL'
    'GetProperty lbcompany listcount '#39'vcnt'#39
    'SET VAR vindex TEXT = '#39'0'#39
    'SET VAR vtmpidx TEXT = '#39'0'#39
    'WHILE (INT(.vindex)) <> (INT(.vcnt)) THEN'
    '  SET VAR vchk = (INT(.vindex))'
    '  PROPERTY lbcompany checkindex .vchk'
    '  GETPROPERTY lbcompany selectedstate '#39'vsel'#39
    '  IF vsel = '#39'TRUE'#39' THEN'
    '    IF vchk <> 0 THEN'
    '      PROPERTY lbcompany unselect .vchk'
    '      SET VAR vtmpidx = (ctxt(((INT(.vindex)) - 1)))'
    '      -- get the value of the current'
    '      PROPERTY lbcompany itemindex .vchk'
    '      GetProperty lbcompany selection '#39'vItem'#39
    '      -- get the value of the item preceeding'
    '      PROPERTY lbcompany itemindex .vtmpidx'
    '      GetProperty lbcompany selection '#39'vText'#39
    '      -- swap the values'
    '      PROPERTY lbcompany itemindex .vchk'
    '      PROPERTY lbcompany selection .vtext'
    '      PROPERTY lbcompany itemindex .vtmpidx'
    '      PROPERTY lbcompany selection .vitem'
    '    ENDIF'
    '  ENDIF'
    '  SET VAR vindex = (CTXT((INT(.vindex)) + 1 ))'
    'ENDWHILE'
    'Getproperty lbcompany listcount '#39'vcnt'#39
    'SET VAR vtext  = ('#39'ListBox "A" has'#39' & .vcnt & '#39'Items'#39')'
    'PROPERTY stxlb1 CAPTION .vtext'
    ''
    'Getproperty lbother listcount '#39'vcnt'#39
    'SET VAR vtext  = ('#39'ListBox "A" has'#39' & .vcnt & '#39'Items'#39')'
    'PROPERTY stxlb2 CAPTION .vtext'
    'RETURN')
end

Reply via email to