Icon Widget, Container, and scrollbar problem - Motif

This is a discussion on Icon Widget, Container, and scrollbar problem - Motif ; Hello Motif Expert people. This is my first time to create an application in Motif. I spent 3 days to solve this problem but I could not solve it. Would you please give me a good guide or the keyword ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Icon Widget, Container, and scrollbar problem

  1. Icon Widget, Container, and scrollbar problem

    Hello Motif Expert people.

    This is my first time to create an application in Motif.
    I spent 3 days to solve this problem but I could not solve it.
    Would you please give me a good guide or the keyword I can look for it?
    Thank you.

    Description:

    I try to create the directory viewer (displaying Icon, filename and
    file size)
    with create a directory button, delete button, and rename button.
    I decided to use the container (detailed) in the scrollbar window, and
    Icon widet.

    I push the delete button after I select one of the directory from the
    container.
    It actually delete the directry from the system.

    Since I don't know how to update the screen, I use XtDestroyWidget to
    delete
    the container, read the directory again, and display the container
    again.

    Problem 1:

    When I do this, the small portion of the directory icon is still
    selectable with values.
    In order to get rid of it, I have to restart the program. Is this
    memory leak?
    I know the destroywidget does not execute until it exit from the
    callback function.
    Is there anyway to execute the DestroyWidget in the Callback function?
    or
    Is there any better way to update the directory structure on the
    container?

    Problem 2:
    after I destroy the container, and rebuild container again,
    the scrollbar did not reinitialize again. The scrollbar stick stays
    where it was before even though it is the top of the list.
    Is there anyway to put scrollbar stick on the top (vertically)? or
    Is there any function to refresh the scrollbar widget?

    Thank you very much.

    Joseph Kim
    jkim778@hotmail.com


  2. Re: Icon Widget, Container, and scrollbar problem


    wrote in message
    news:1145490960.533217.141920@i40g2000cwc.googlegr oups.com...
    > Hello Motif Expert people.
    >
    > This is my first time to create an application in Motif.
    > I spent 3 days to solve this problem but I could not solve it.
    > Would you please give me a good guide or the keyword I can look for it?
    > Thank you.
    >
    > Description:
    >
    > I try to create the directory viewer (displaying Icon, filename and
    > file size)
    > with create a directory button, delete button, and rename button.
    > I decided to use the container (detailed) in the scrollbar window, and
    > Icon widet.
    >
    > I push the delete button after I select one of the directory from the
    > container.
    > It actually delete the directry from the system.
    >
    > Since I don't know how to update the screen, I use XtDestroyWidget to
    > delete
    > the container, read the directory again, and display the container
    > again.
    >
    > Problem 1:
    >
    > When I do this, the small portion of the directory icon is still
    > selectable with values.
    > In order to get rid of it, I have to restart the program. Is this
    > memory leak?
    > I know the destroywidget does not execute until it exit from the
    > callback function.
    > Is there anyway to execute the DestroyWidget in the Callback function?
    > or
    > Is there any better way to update the directory structure on the
    > container?
    >
    > Problem 2:
    > after I destroy the container, and rebuild container again,
    > the scrollbar did not reinitialize again. The scrollbar stick stays
    > where it was before even though it is the top of the list.
    > Is there anyway to put scrollbar stick on the top (vertically)? or
    > Is there any function to refresh the scrollbar widget?
    >
    > Thank you very much.
    >
    > Joseph Kim
    > jkim778@hotmail.com
    >


    Just destroy the child or children that represent the directory you just
    deleted,
    not the entire container. The container should then re-draw itself.

    If necessary, call XmContainerRelayout(container) after the destroy oif the
    child(ren).

    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  3. Re: Icon Widget, Container, and scrollbar problem

    Hello Fred.
    Thanks for the reply.

    I tried what you said inside of my push button callback function ..

    XtDestroyWidget(DIRSelected_Item); // DIRSelected_Item is global
    variable (Widget).
    // Got this
    value from the select_callback function;
    XmContainerRelayout(DIRcontainer);

    The result is that it delete the seleted item (Which is
    iconwidget(directory pixmap), detailed info.(directory name and size))
    from the detailed layout container list,
    but, it displays the small portion of the directory icon (pixmap), and
    it is selectable.
    Is it because I did not destroy the icon first? or Is it because I
    tried to destroy the Widget inside of callback function?
    Is there anyway to solve this problem?

    Thank you very much.

    Joseph Kim


  4. Re: Icon Widget, Container, and scrollbar problem

    By the way, I don't think I can destroy the icon (using destroyPixmap)
    because it is the directory icon and it is used by other directories
    list.


  5. Re: Icon Widget, Container, and scrollbar problem


    wrote in message
    news:1145553963.446003.169970@i40g2000cwc.googlegr oups.com...
    > Hello Fred.
    > Thanks for the reply.
    >
    > I tried what you said inside of my push button callback function ..
    >
    > XtDestroyWidget(DIRSelected_Item); // DIRSelected_Item is global
    > variable (Widget).
    > // Got this
    > value from the select_callback function;
    > XmContainerRelayout(DIRcontainer);
    >
    > The result is that it delete the seleted item (Which is
    > iconwidget(directory pixmap), detailed info.(directory name and size))
    > from the detailed layout container list,
    > but, it displays the small portion of the directory icon (pixmap), and
    > it is selectable.
    > Is it because I did not destroy the icon first? or Is it because I
    > tried to destroy the Widget inside of callback function?
    > Is there anyway to solve this problem?
    >
    > Thank you very much.
    >
    > Joseph Kim
    >

    Without seeing your code, it is hard to figure out what's happening.
    Also, it is not clear what it is you are trying to do.
    Also it is not clear what Motif level you are using. 2.1? 2.2?
    Perhaps you should be using a Tree instead of a Container.
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  6. Re: Icon Widget, Container, and scrollbar problem


    wrote in message
    news:1145554684.640446.64710@i39g2000cwa.googlegro ups.com...
    > By the way, I don't think I can destroy the icon (using destroyPixmap)
    > because it is the directory icon and it is used by other directories
    > list.
    >

    You don't destroy the pixmap, you destroy the IconWidget that contains the
    pixmap.
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project



  7. Re: Icon Widget, Container, and scrollbar problem

    Hello Fred.

    I am using Motif 2.1
    I did not destroy the icon(pixmap.)
    I destroyed iconwidget, but I still have a same problem.

    here is the actual source code..

    //Global variable
    Widget DIRSelected_Item = NULL;

    //Container selection callback function. : allows only one selection.
    static void select_callback( Widget w,
    XtPointer client_data,
    XtPointer call_data)
    {
    XmContainerSelectCallbackStruct *cptr;
    cptr = (XmContainerSelectCallbackStruct *) call_data;
    if (0 < cptr->selected_item_count)
    DIRSelected_Item = cptr->selected_items[0];
    else
    DIRSelected_Item = NULL;
    }


    void DeleteButton_callback (Widget w, XtPointer client_data, XtPointer
    xt_call_data)
    {
    //delete the directory from the system : It works fine
    DeleteDirectory(selected_item_directory_name_strin g);

    //Tries to update the container Widget without the directory I
    deleted.
    XtDestroyWidget(DIRSelected_Item); //You can assume
    DIRSelected_Item has a value
    XmContainerRelayout(DIRcontainer); //DIRcontainer is a
    container with directory structure.
    }

    Any idea?
    Thank you very much.

    Joseph Kim
    jkim778@hotmail.com


  8. Re: Icon Widget, Container, and scrollbar problem

    Hello Fred.

    It's working!!!
    Thanks for all information you gave me.

    It was my stupid mistake.
    I build a directory list (iconwidget) two times.
    Therefore, I got a small portion of icon image.

    Anyway, thanks for helping me out.

    Joseph Kim
    jkim778@hotmail.com


+ Reply to Thread