Dialog Boxes - Mode_Tile Question

Discussion in 'AutoCAD' started by mlv, Oct 20, 2006.

  1. mlv

    mlv Guest

    Windows XP, AutoCAD 14 & 2006

    Is there any way on initialising a dialog box that, if a particular button
    is greyed out, the focus will shift to a list box and select and highlight
    the first item in that list box?

    I have no problem with greying out the button (mode_tile "b_key" 1) or
    shifting focus to the list box (mode_tile "lb_key" 2). There appears to be
    a kind of 'selection frame' around the first item in the list box, but I
    can't get the item to highlight and therefore be selected by default.

    The list box in question has 'multiple_select = true;' set.

    Thanks
     
    mlv, Oct 20, 2006
    #1
  2. mlv

    Jiro Guest

    HiHo;
    Set the attribute "is_default = true".
     
    Jiro, Oct 21, 2006
    #2
  3. mlv

    mlv Guest

    Hi

    I don't think this will work.

    "is_default = true;" would have to be set in the dcl file, whilst I want to
    control the focus from the associated lisp file. Anyway, the standard
    'OK_Button' defined in Base.dcl already has "is_default = true;" set, and
    you can only set it once.

    With my routine, normally a button called 'Last' is the default, but
    sometimes this button has to be greyed out when the dialog box is initiated.
    When this button is greyed out, I want the focus will shift to a list box
    and select and highlight the first item in that list box.

    I have tried the routine with the list box set "is_default = true;" and have
    removed "is_default = true;" from the OK retirement button definition. The
    list box now has focus, but the first item is still not selected and
    highlighted.
     
    mlv, Oct 23, 2006
    #3
  4. mlv

    JP Guest

    I'm also unable to highlight the listbox, only when clicked on.
    Solved it simple, make sure that the initial value is set:
    (SET_TILE "xxxx" "0") xxxx is the name of the listbox, 0 is the first
    value from the list
    on OK or selecting the listbox I retrieve the value clicked:
    (SETQ zxxxz (ATOI(GET_TILE "xxxx"))) <-what value is chosen
    when the listbox has not been chosen I use (just OK clicked):
    (IF(= zxxxz NIL)(SETQ zxxxz 0)) <- to make sure something is set

    I use the above techniques trough all of my progs; users are lazy, no matter
    how you build the progs, they always 'forget' to push or click a button.

    Hope it helps a little.

    Regards,
    Jan
     
    JP, Oct 24, 2006
    #4
  5. mlv

    mlv Guest

    Thanks Jan, it worked fine.
     
    mlv, Oct 24, 2006
    #5
  6. mlv

    JP Guest

    Been doing some more experimenting.
    Finally succeeded in getting the focus to an edit-box or list-box !!
    The trick is:
    first assign values to the list and point to the first value as shown.
    now this:
    (MODE_TILE "xxxxx" 2) ; puts the focus to the list box or edit box
    (MODE_TILE "xxxxx" 3) ; activates the list box or edit box, ready for
    selecting/typing over (makes it blue)

    You MUST use the mode_tile 2 and 3, omit one of them and it won't work.

    Hope it solves your problem completely now.

    Regards,
    Jan
     
    JP, Oct 26, 2006
    #6
  7. mlv

    mlv Guest

    Interesting - I had tried:

    (mode_tile "xxxxx" 2)

    followed by:

    (mode_tile "xxxxx" 3)

    before I posted my question, and it didn't work. It worked OK for an Edit
    Box, but not for a List Box. I hadn't pointed to the first List Box item
    with
    (set_tile "xxxxx" "0") though.

    With a List Box, if I use:

    (mode_tile "xxxxx" 2)

    followed by:

    (set_tile "xxxxx" "0") ["0" selects the first List Box item.] then it works
    fine - the List Box receives focus and the first List Box item is
    highlighted. I don't need to use (mode_tile "xxxxx" 3).

    IIRC, (mode_tile "xxxxx" 3) is platform dependent, and doesn't need to be
    called on some systems. I guess my system doesn't need it.
     
    mlv, Oct 27, 2006
    #7
  8. mlv

    JP Guest

    Fine that it works.
    Just bear in mind that someday your program should run on another computer
    where this mode 3 could be needed.
    Always try to make the program 'portable' to other systems (even your
    co-worker might have a different system).

    Regards,
    jan

     
    JP, Oct 30, 2006
    #8
  9. mlv

    mlv Guest

    Good point.

    It certainly does no harm to call 'mode 3'.
     
    mlv, Oct 30, 2006
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.