Interclient Communication

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
Interclient Communication

Submitted by Anonymous (not verified) on Fri, 06/15/2012 - 12:07

Hi,
I am newbie in Motif.
I`d like to be able to communication between two or more X-clients using XSendEvent with Eventtype ClientMessage.
My problem is how to fine the proper way to send a data from client to client.
And I`d like to make a event to refresh display.
I don`t have any kind keyboard and mouse because I am developing embedded software.
Could you write a simple example... about my question...
Thanks for reading...
‹ Stop XtAppMainLoop (app) Advanced Line Styles ›

Anonymous

Wed, 10/15/2003 - 05:19#1

Interclient Communication (My Source Code)

How can I write a proper code to make a event in function fn_WidgetChagne...........

Help..............

My example code..........
==================================================
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "locale.h"

#include

#define KFONT "-baekmuk-gulimbdf-bold-r-normal--18-180-75-75-m-180-ksc5601.1987-0"
#define EFONT "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1"
#define KOREAN "koreanEUC"
#define ENGLISH "englishEUC"

int FCS;
XFontSet fontSet;
XFontSet fontSet1;
XmFontListEntry flEntry;
XmFontListEntry flEntry1;
XmFontList fontList;
char **missing_charsets;
int num_missing_charsets;
char *default_string;
int i;

Cursor XmeGetNullCursor(Widget widget);

void ctest(Widget, XtPointer, XmPushButtonCallbackStruct *);

Widget form;

Widget fnMenuMake(int x, char *menu_name)
{
Widget wMenu;
XmString labelStr;

wMenu = XtVaCreateManagedWidget(NULL,
xmPushButtonWidgetClass, form,
XmNbottomAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, x,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, x+MENU_BUTTON_WIDTH,
XmNtopAttachment, XmATTACH_POSITION,
XmNtopPosition, MENU_Y_POSITION,
NULL);

labelStr = XmStringCreate(menu_name, KOREAN);
XtVaSetValues(wMenu,
XmNlabelString, labelStr,
XmNfontList, fontList,
NULL);
XmStringFree(labelStr);

return wMenu;
}

Widget fnLabelMake(int x, int width, int y, int height, char *label_name)
{
Widget wLabel;
XmString labelStr;

wLabel = XtVaCreateManagedWidget(NULL,
xmPushButtonWidgetClass, form,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, x,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, x+width,
XmNtopAttachment, XmATTACH_POSITION,
XmNtopPosition, y,
XmNbottomAttachment, XmATTACH_POSITION,
XmNbottomPosition, y+height,
NULL);

labelStr = XmStringCreate(label_name, KOREAN);
XtVaSetValues(wLabel,
XmNlabelString, labelStr,
XmNfontList, fontList,
NULL);
XmStringFree(labelStr);

return wLabel;
}

Widget fnTextMake(int x, int width, int y, int height)
{
Widget wText;

wText = XtVaCreateManagedWidget(NULL,
xmTextWidgetClass, form,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, x,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, x+width,
XmNtopAttachment, XmATTACH_POSITION,
XmNtopPosition, y,
XmNbottomAttachment, XmATTACH_POSITION,
XmNbottomPosition, y+height,
XmNbackground, BLACK,
XmNcursorPositionVisible, FALSE,
NULL);

return wText;
}

Widget fnTitleMake(int x, int width, int y, int height, char *title_name)
{
Widget wTitle;
XmString labelStr;

labelStr = XmStringCreateSimple(title_name);

wTitle = XtVaCreateManagedWidget(NULL,
xmPushButtonWidgetClass, form,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, x,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, x+width,
XmNtopAttachment, XmATTACH_POSITION,
XmNtopPosition, y,
XmNbottomAttachment, XmATTACH_POSITION,
XmNbottomPosition, y+height,
XmNalignment, XmALIGNMENT_BEGINNING,
XmNbackground, BLUE,
NULL);

labelStr = XmStringCreate(title_name, KOREAN);
XtVaSetValues(wTitle,
XmNlabelString, labelStr,
XmNfontList, fontList,
NULL);
XmStringFree(labelStr);

return wTitle;
}

Widget fnBITResult(int x, int width, int y, int height, int result)
{
Widget wLabel;
XmString labelStr;

if (result == PASS)
{
wLabel = XtVaCreateManagedWidget(NULL,
xmPushButtonWidgetClass, form,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, x,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, x+width,
XmNtopAttachment, XmATTACH_POSITION,
XmNtopPosition, y,
XmNbottomAttachment, XmATTACH_POSITION,
XmNbottomPosition, y+height,
XmNbackground, BLUE,
NULL);

labelStr = XmStringCreate("PASS", KOREAN);
XtVaSetValues(wLabel,
XmNlabelString, labelStr,
XmNfontList, fontList,
NULL);
XmStringFree(labelStr);
}
else if (result == FAIL)
{
wLabel = XtVaCreateManagedWidget(NULL,
xmPushButtonWidgetClass, form,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, x,
XmNrightAttachment, XmATTACH_POSITION,
XmNrightPosition, x+width,
XmNtopAttachment, XmATTACH_POSITION,
XmNtopPosition, y,
XmNbottomAttachment, XmATTACH_POSITION,
XmNbottomPosition, y+height,
XmNbackground, RED,
NULL);

labelStr = XmStringCreate("FAIL", KOREAN);
XtVaSetValues(wLabel,
XmNlabelString, labelStr,
XmNfontList, fontList,
NULL);
XmStringFree(labelStr);
}

return wLabel;
}

Widget *gresult1_1;

void fn_WidgetChagne()
{
XEvent *event;
while(1)
{
if(FCS == 1)
{
*gresult1_1 = fnBITResult(70, 25, 40, 15, FCS);
XSendEvent(...................);
break;
}
else if(FCS == 0)
{
*gresult1_1 = fnBITResult(70, 25, 40, 15, FCS);
XSendEvent(...................);
break;
}
}
}

postMain (int argc, char **argv)
{
XtAppContext app;
Widget top_wid;

Widget title1, menu1, label1, label2, lru1,
result1;

Arg args[10];
int n=0;
XmString labelStr;

gresult1_1 = (Widget *) &result1;

form = XtVaCreateManagedWidget("FORM",
xmFormWidgetClass, top_wid,
XmNwidth, X_RESOLUTION,
XmNheight, Y_RESOLUTION,
XmNfractionBase, X_LENGTH,
NULL);

XtManageChild(form);

menu1 = fnMenuMake(0, "STOP");

title1 = fnTitleMake(0, 800, 0, 10, "POST");

label1 = fnLabelMake(20, 50, 20, 20, "LRU");
label2 = fnLabelMake(70, 25, 20, 20, "Result");

lru1 = fnLabelMake(20, 50, 40, 15, "COM");
result1 = fnBITResult(70, 25, 40, 15, FCS);

XtRealizeWidget (top_wid);
XtAppMainLoop (app);
}

ICS_support

Mon, 10/27/2003 - 21:13#2

Interclient Communication

A better way to do this is to establish a property which names a window which you can use to send information in a proprietary format. For example code, see the sample by John Cwikla elsewhere on this site, which uses this mechanism to have one application check whether another instance of itself is already running.