home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / windows / x / motif / 8352 < prev    next >
Encoding:
Text File  |  1993-01-05  |  2.0 KB  |  74 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!yhtao
  3. From: yhtao@magnus.acs.ohio-state.edu (Yu-Hui Tao)
  4. Subject: XmStringGetLtoR gave me a null string in C++!!
  5. Message-ID: <1993Jan5.212112.29967@magnus.acs.ohio-state.edu>
  6. Sender: news@magnus.acs.ohio-state.edu
  7. Nntp-Posting-Host: top.magnus.acs.ohio-state.edu
  8. Organization: The Ohio State University
  9. Date: Tue, 5 Jan 1993 21:21:12 GMT
  10. Lines: 62
  11.  
  12. Hi, netters:
  13.  
  14.   I am rewriting a working C/Motif program to C++ version. One problem 
  15. I have so far is that XmStringGetLtoR gave me an EMPTY string in my C++ 
  16. program. 
  17.  
  18.   The C++ version of the program is roughly like this:
  19.  
  20.  
  21. Step 1.
  22.    In UI::timebt(int Index) I registered two callback functions for a
  23.    PromptDialog dialog:
  24.    
  25.  
  26.     XtAddCallback(duetimedialog,XmNokCallback,&UI::duetimeCB,
  27.         (XtPointer)this);
  28.         XtAddCallback(duetimedialog,XmNcancelCallback,&UI::duetimeCB,
  29.               (XtPointer)this);
  30.  
  31. Step 2.
  32.    This is my UI::duetimeCB: 
  33.  
  34.    void UI::duetimeCB ( Widget w, XtPointer clientData, XtPointer callData)
  35.    {
  36.      UI *obj = (UI *) clientData;
  37.      XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *) 
  38.         callData;
  39.      obj->duetimeF (cbs);
  40.    }
  41.  
  42. Step 3.
  43.    This is part of the UI::duetimeF:
  44.  
  45.    void UI::duetimeF(XmSelectionBoxCallbackStruct *cbs)
  46.    { 
  47.     char *dt_ptr;
  48.  
  49.     switch (cbs->reason)
  50.     {
  51.         case XmCR_OK:
  52.             // get the string from the event structure.
  53.             XmStringGetLtoR(cbs->value,"charset1", &dt_ptr);
  54.         printf("dt_ptr is %s\n",dt_ptr);
  55.  
  56.   
  57. The *dt_ptr is a null string. The "charset1" is setup previously and 
  58. being used just fine. I even had a default string showed on the 
  59. textfield of the PromptDialog dialog.  
  60.  
  61. Does this has something to do with the way I setup cbs? On the other hand,
  62. cbs->reason is recognized by the switch function! 
  63.  
  64. Environment: g++2.2.2/Motif1.1.3/Ultrix4.2/DECstation 3100.
  65.  
  66. Any response is appreciated!
  67.  
  68. Yu-Hui Tao
  69. ISE, OSU
  70. tao@CSEL.eng.ohio-state.edu
  71. ===========================
  72.  
  73.   
  74.