Thread View: comp.windows.x
1 messages
1 total messages
Started by ross derrod
Wed, 05 May 1993 18:33
Xview Multiline Text Field Menu Deactivation Solution
Author: ross derrod
Date: Wed, 05 May 1993 18:33
Date: Wed, 05 May 1993 18:33
100 lines
3969 bytes
3969 bytes
/*----------------------------------------------------------*
* OpenWindows 3.0 and XView Version 3 problem and solution *
*----------------------------------------------------------*/
Fellow netters :
I was seeking advice on how to de-activate the pop-up text edit
menu that is associated with a multiline text field widget in XView.
I have a panel with many panel items. Some of the items need to be
able to properly handle MENU mouse events (e.g., choice lists using stack
look and feel) while one item, the multiline text field widget, needs to
ignore the MENU mouse events.
This problem stems from the fact that I want a simple multiline text field
for the user to enter text. I do not want them to be able to do all of the
things that you can do with a text pane (e.g, cut/paste/save to a file).
It seems that I can't get a handle to this popup text edit menu that is
associated with the multiline text field.
I was provided a quick response from fellow netter
Thu Vu (tvu@su102d.ess.harris.com). He obtained this helpful info from
John Fischer (John.Fischer@Corp.Sun.COM)
Here's a snipet of code that illustrates the solution.
Note this following comment from our friend at Sun -
This is ugly but it works. Also this currently works
in XView but could always change (ie. no guarantees).
This code is dependent up PANEL_ITEM_NTH_WINDOW returning
a TEXTSW. You could re-write it so that it checked the
type returned and iff it was a TEXTSW then finish processing.
Also I don't really like the WIN_MENU code, especially when
the documentation states that it is there for backwards
compatibility with SunView.
------------------------------------------------------------------
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/textsw.h>
Panel_item mtext;
void
change_proc(item,event)
Panel_item item;
Event *event;
{
Xv_window obj;
char string[256];
static int i = 0;
obj = (Xv_window)xv_get(mtext, PANEL_ITEM_NTH_WINDOW, 0);
textsw_reset(obj, 0, 0);
sprintf(string, "Test %d", ++i);
xv_set(mtext, PANEL_VALUE, string, NULL);
}
main(argc,argv)
int argc;
char *argv[];
{
Frame frame;
Panel panel;
Menu mmenu;
Xv_window obj;
(void)xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(NULL,FRAME,NULL);
panel = (Panel)xv_create(frame,PANEL,NULL);
(void)xv_create(panel,PANEL_BUTTON,
PANEL_LABEL_STRING, "Change",
PANEL_NOTIFY_PROC, change_proc,
NULL);
mtext = (Panel_item)xv_create(panel,PANEL_MULTILINE_TEXT,
PANEL_DISPLAY_ROWS, 5,
PANEL_READ_ONLY, TRUE,
NULL);
obj = (Xv_window)xv_get(mtext, PANEL_ITEM_NTH_WINDOW, 0);
mmenu = (Menu)xv_get(obj, XV_KEY_DATA, TEXTSW_MENU_DATA_KEY);
xv_destroy(mmenu);
mmenu = (Menu)xv_create(NULL, MENU, NULL);
xv_set(obj, WIN_MENU, mmenu, NULL);
xv_main_loop(frame);
}
--------------------------------------------------------------------------------
Thanks for all of your help,
Long Live The Net :-)
Ross Derrod
Lawrence Berkeley Laboratory
email address : RADerrod@lbl.gov
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads