| > 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-
|