Jump to content
BG913

Selection of components as per user

Recommended Posts

Hi,

 

Is there a way to select components in the order the user selects ?? I checked for *createlistpanel but it isn't applicable for components, and hm_getmark always gives a result of a list which is ascending order only.

Share this post


Link to post
Share on other sites

Why do you need that?

A workaround is : select elem list, and then retrieve component list that store them.

 

Directly, I think we can hook a callback with event graphic_selection_changes

Pandurang likes this

Share this post


Link to post
Share on other sites

Actually for this code I really want it as a component selection rather than element. That way the user knows the entire range of selection he/she is making. Like as much as possible I want to avoid the element selection as it would be not as appealing to the user.

 

And I'm sorry, I don't know much about graphic selection changes, haven't explored those options.

Share this post


Link to post
Share on other sites

please Try this:

 

variable list1

proc framework args \
{
    *createmarkpanel comps 1 "Please select the components ";
    hm_framework registerproc getorderedcomps graphics_selection_changed;

   *clearmark comps 1;

}

proc getorderedcomps args \
{
    
    variable list1;
    lappend list1 [noIntersect;];
    
}

proc noIntersect args \
{

    variable list1;
    
    foreach item [hm_getmark comps 1] \
    {
    
        if {$item in $list1} \
        {
            continue;
        } else {set comp $item};
    
    }
    return $comp
}

framework
puts $list1

Livil Lyle and tinh like this

Share this post


Link to post
Share on other sites

@BG913

Even if deselect component this will take care of it.. Thanks To @tinh for suggestion...

 

Please try this updated one:

 

variable list1

proc framework args \
{
    *createmarkpanel comps 1 " ";
    hm_framework registerproc getorderedcomps graphics_selection_changed;

}

proc getorderedcomps args \
{
    
    variable list1;
    set value [noIntersect]
    if {$value != ""} \
    {
        lappend list1 $value ;
    }    
    
}

proc noIntersect args \
{

    variable list1;
    set marklist [hm_getmark comps 1];
    foreach item $marklist \
    {
    
        if {$item in $list1} \
        {
            continue;
        } else {set comp $item};
    
    }
    if {[info exist comp]} \
    {
        return $comp
    } else \
    {
        foreach item $list1 \
        {
    
        if {$item in $marklist} \
        {
            continue;
        } else \
        {    
            set list1 [lremove $list1 $item]
        }
    
        }
    }
}

framework
puts $list1

Edited by Pandurang

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...