[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg
Subject: Re: Motif/Xt: Dynamically resize the visible item count of an XmList
From: "Chris Sorenson" <csoren () cpinternet ! com>
Date: 2022-01-14 22:54:56
Message-ID: 1642200896.vjkuy9qhus448kss () webmail ! mycci ! net
[Download RAW message or body]
>
> Message: 1
> Date: Wed, 12 Jan 2022 23:57:37 +0100
> From: Holger Sebert
> To: xorg@lists.x.org
> Subject: Re: Motif/Xt: Dynamically resize the visible item count of an
> XmList
> Message-ID: <08d618bb-c03e-4880-b332-c5e53ceb45bd@ruhr-uni-bochum.de>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> I have attached a small example program to illustrate the behavior.
> Just try to resize the main window and observe how the ScrolledList
> widget is NOT properly resized.
>
> Maybe it's a feature, I don't know. But it looks like I'll have
> to write my own manager widget to accomplish the task.
>
> Best,
> Holger
>
I think you might be overthinking this a bit, here's something I just dashed off that \
I think might be along the lines of what you're looking for, (attached program), note \
you'll also need to link it to libXmu as I've added a call to support Editres.
Hopefully the attachment comes through...
["new_attach02.c" (text/x-c)]
#include <Xm/Form.h>
#include <Xm/ScrolledW.h>
#include <Xm/List.h>
#include <X11/Xmu/Editres.h>
#include <malloc.h>
char * months[] =
{
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
};
int main(int argc, char * argv[])
{
XtAppContext app_context;
Widget toplevel, form_w, scrolled_w, list_w;
Arg av[10];
Cardinal ac = 0;
int n = XtNumber (months);
XmStringTable str_list;
str_list = (XmStringTable) XtMalloc (n * sizeof (XmString));
XtSetLanguageProc(NULL, NULL, NULL);
static XrmOptionDescRec options[] =
{
{ (char *) "-help", (char *) "*help", XrmoptionNoArg, (char *) "TRUE" }
};
toplevel = XtOpenApplication(
&app_context, /* app_context_return */
"Chart-B.21", /* from page 71 of Revere's book */
options, /* options: None ATM */
XtNumber(options), /* num_options */
&argc, /* argc_in_out */
argv, /* argv_in_out_cluelessness */
NULL, /* fallbackResources: None ATM */
applicationShellWidgetClass, /* widget_class */
av, /* args */
ac); /* num_args */
form_w = XtVaCreateManagedWidget((char *) "FormWindow",
xmFormWidgetClass, toplevel,
XmNheight, 400,
XmNwidth, 400,
NULL);
scrolled_w = XtVaCreateManagedWidget((char *) "ScrolledWindow",
xmScrolledWindowWidgetClass, form_w,
XmNscrollingPolicy, XmAUTOMATIC,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, form_w,
/* XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, form_w,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, form_w,*/
XmNbottomAttachment, XmATTACH_WIDGET,
XmNbottomWidget, form_w,
NULL);
for (int i = 0; i < n; i++)
str_list[i] = XmStringCreateLocalized (months[i]);
list_w = XtVaCreateManagedWidget((char *) "ListWindow",
xmListWidgetClass, scrolled_w,
XmNvisibleItemCount, n,
XmNitemCount, n,
XmNitems, str_list,
NULL);
for (int i = 0; i < n; i++)
XmStringFree (str_list[i]);
free (str_list);
XtAddEventHandler (toplevel, 0, 1, _XEditResCheckMessages, NULL);
XtRealizeWidget (toplevel);
XtAppMainLoop (app_context);
return 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic