Alpha Video Training
Results 1 to 6 of 6

Thread: Owner Draw Listbox - Computed Display coding problem

  1. #1
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    753

    Default Owner Draw Listbox - Computed Display coding problem

    copied this code from the documentation, but it has an error and I dont know what it is, can anyone help me please?
    dim arr[0] as p
    arr[].fname = "Sam"
    arr[..].lname = "Raven"
    arr[].fname = "Charles"
    arr[..].lname = "Chambliss"
    arr[].fname = "Dion"
    arr[..].lname = "Smits"

    index = 1
    dim fmt as c = ".fname"
    ui_dlg_box("Owner Draw Listbox - Computed Display",<<%dlg%
    {wrap=40}
    {repaint_begin=fmt}
    Select the property to display:;
    [.10fmt^={.fname,.lname}];
    [%O==eval(value+fmt)%.50,5index^#arr];
    Listbox can show an expression showing a calculation involving properties in the array:;
    [%O==eval(value+".fname+' '+" + value + ".lname" )%.50,5index^#arr];
    A more complex expression:;
    [%O==eval("upper(" + value+".fname)+' '+" + value + ".lname" )%.50,5index^#arr];
    You can call a UDF to compute the data to display:;
    \(This is the most flexible option.);
    [%O==testFNvalue?%.50,5index^#arr];
    {repaint_end}

    %dlg%)

    'value is a placeholder for 'arr'. eval(value) passes in the the current row in the array to the function.


    function testFN as c (ar as p)
    testFN = upper(ar.lname) + ", " + f_upper(ar.fname)
    if ar.lname = "chambliss" then
    testFN = "{I:'$$generic.orb.green.small'} " + testFN
    else
    testFN = "{I:'$$generic.orb.blue.small'} " + testFN
    end if

    end function
    the line
    [%O==testFNvalue?%.50,5index^#arr]

    doesnt work for some reason, although it is coded as stated in the documentation example.

    The original document is available at http://wiki.alphasoftware.com/Xdialog+ListBoxes+Dynamically+Computing+the+Display+Expression+V10







    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  2. #2
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,644

    Default Re: Owner Draw Listbox - Computed Display coding problem

    you need to put in the '.' before value

    [%O==testFN.value?%.50,5index^#arr]
    Last edited by Al Buchholz; 08-07-2019 at 01:07 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  3. #3
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    753

    Default Re: Owner Draw Listbox - Computed Display coding problem

    Nope, that doesn't work either
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,644

    Default Re: Owner Draw Listbox - Computed Display coding problem

    That's odd. I copied your script and that is all I changed to get the xdialog to display.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,069

    Default Re: Owner Draw Listbox - Computed Display coding problem

    Code:
    You can call a UDF to compute the data to display:;
    \(This is the most flexible option.);
    [%O==testFN(eval(value))%.50,5index^#arr];
    {repaint_end}
    
    %dlg%)
    
    'value is a placeholder for 'arr'. eval(value) passes in the the current row in the array to the function.
    This, [%O==testFN(eval(value))%.50,5index^#arr]; is working at here

  6. #6
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    753

    Default Re: Owner Draw Listbox - Computed Display coding problem

    thanks John.
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

Similar Threads

  1. Coding Dates and Display problem
    By Ted Giles in forum Alpha Five Version 9 - Desktop Applications
    Replies: 10
    Last Post: 12-02-2008, 11:44 AM
  2. Xdialog Owner Draw String to create vertical column line
    By Jim Chapman in forum Alpha Five Version 7
    Replies: 1
    Last Post: 12-10-2005, 05:57 PM
  3. Owner Draw
    By dik_coleman in forum Alpha Five Version 5
    Replies: 3
    Last Post: 08-02-2004, 06:08 PM
  4. Two Owner Draw directives in conflict?
    By Bob Pickle in forum Alpha Five Version 5
    Replies: 3
    Last Post: 12-21-2003, 10:52 AM
  5. owner draw strings in text edit controls?
    By Peter.Wayne in forum Alpha Five Version 5
    Replies: 7
    Last Post: 11-10-2002, 10:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •