[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3494.0. "Questions on VTOOLKIT" by HANDVA::NELSONNG () Fri Oct 19 1990 07:13

Hi,
	There are some questions below.  Is there anyone who has any idea
    on them?    
     
    I would like to use VLIST of VTOOLKIT to replace STEXT in my 
application.  In my application, there is a one TEXT line-item per line.
Each field has 256 characters.

1. How can I extract a sub-string within a line-item?

For example, I would like to get a string "kind" from the sentence
"It's very kind of you" when the cursor is in the letter "d" of the word "kind".
i.e. My question is : How can I get a sub-string from the cursor position out of
a TEXT line-item?

2. Can I see a cursor in a VLIST?
   If not, how can I display a cursor within VLIST?

3. I really want to use VLIST to replace STEXT in my application.
   Can VLIST do the job of STEXT?
   Can I aplly the same Dwt and Xt routines operated on STEXT to VLIST?

4. Is there any examples of Creating VLIST using XtCreatWidget?
   TestVlist.c is very good but it demonstrates the use of UIL and not 
   low-level routine.

   Is there any examples demonstrating the Creation of VLIST using low-level
   routines e.g. XtCreatWidget?

   If there are any examples or comments concerning the questions, could you
   give me some pointers to them?

Thanks in advance.

Regards,
Nelson.

                                                  
T.RTitleUserPersonal
Name
DateLines
3494.1One solution I've seenLOWELL::KLEINFri Oct 19 1990 11:0157
>    I would like to use VLIST of VTOOLKIT to replace STEXT in my 
>application.  In my application, there is a one TEXT line-item per line.
>Each field has 256 characters.

What is often done is to use a VList widget PLUS one SText widget.
The SText widget is set up with a zero-width border and the
same font as the VList widget.

When the user clicks on a VList entry, the SText widget (which normally
is unmanaged) is set to the size and position of the selected VList entry,
and is then managed.  This all happens so quickly that it appears to the
user that the selected entry suddenly became editable.

When the user finally hits <return> (or selects a different VList entry),
the value in the SText widget is retrieved and the underlying VList entry
is updated with the new string.  Then, the SText widget is unmanaged.

So, you see, you get all the capabilities of an array of SText widgets
without the overhead.

There is one routine you will need that is missing from your version
of the VList widget, called VListLineToCell, that takes a line closure
(ID) and returns the x,y,width,height of the cell containing the text
for that line.  You can use these x,y,width,height values to configure
the SText widget before managing it.

-----------------
int VListLineToCell(closure, xP, yP, widthP, heightP)
    Opaque closure;
    int *xP, *yP, *widthP, *heightP;
{
    int line, column, tier;

    if ((line = ClosureToLine (w, closure)) == (-1)) return (0);
    LineToColumnTier (w, line, &column, &tier);
    ColumnTierToCell (w, column, tier, xP, yP, widthP, heightP);
}
-----------------

>4. Is there any examples of Creating VLIST using XtCreatWidget?
>   TestVlist.c is very good but it demonstrates the use of UIL and not 
>   low-level routine.
>
>   Is there any examples demonstrating the Creation of VLIST using low-level
>   routines e.g. XtCreatWidget?

Yes, you can create a VList widget from straight XtCreateWidget calls,
but it seemed so unlikely that anyone was still writing new applications
without using UIL that I scrapped my sample program that showed how to do it.

You have to create each piece of the widget individually (VFrame first,
then the VList and optionally the VHeader, vertical and horizontal scrollbars).
The hierarchy is documented in vlist.note.  If you have trouble, let me know.

But it really would be easier in UIL...

-steve-