home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!yhtao
- From: yhtao@magnus.acs.ohio-state.edu (Yu-Hui Tao)
- Subject: XmStringGetLtoR gave me a null string in C++!!
- Message-ID: <1993Jan5.212112.29967@magnus.acs.ohio-state.edu>
- Sender: news@magnus.acs.ohio-state.edu
- Nntp-Posting-Host: top.magnus.acs.ohio-state.edu
- Organization: The Ohio State University
- Date: Tue, 5 Jan 1993 21:21:12 GMT
- Lines: 62
-
- Hi, netters:
-
- I am rewriting a working C/Motif program to C++ version. One problem
- I have so far is that XmStringGetLtoR gave me an EMPTY string in my C++
- program.
-
- The C++ version of the program is roughly like this:
-
-
- Step 1.
- In UI::timebt(int Index) I registered two callback functions for a
- PromptDialog dialog:
-
-
- XtAddCallback(duetimedialog,XmNokCallback,&UI::duetimeCB,
- (XtPointer)this);
- XtAddCallback(duetimedialog,XmNcancelCallback,&UI::duetimeCB,
- (XtPointer)this);
-
- Step 2.
- This is my UI::duetimeCB:
-
- void UI::duetimeCB ( Widget w, XtPointer clientData, XtPointer callData)
- {
- UI *obj = (UI *) clientData;
- XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)
- callData;
- obj->duetimeF (cbs);
- }
-
- Step 3.
- This is part of the UI::duetimeF:
-
- void UI::duetimeF(XmSelectionBoxCallbackStruct *cbs)
- {
- char *dt_ptr;
-
- switch (cbs->reason)
- {
- case XmCR_OK:
- // get the string from the event structure.
- XmStringGetLtoR(cbs->value,"charset1", &dt_ptr);
- printf("dt_ptr is %s\n",dt_ptr);
-
-
- The *dt_ptr is a null string. The "charset1" is setup previously and
- being used just fine. I even had a default string showed on the
- textfield of the PromptDialog dialog.
-
- Does this has something to do with the way I setup cbs? On the other hand,
- cbs->reason is recognized by the switch function!
-
- Environment: g++2.2.2/Motif1.1.3/Ultrix4.2/DECstation 3100.
-
- Any response is appreciated!
-
- Yu-Hui Tao
- ISE, OSU
- tao@CSEL.eng.ohio-state.edu
- ===========================
-
-
-