[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

62.0. "problems function call xtgetvalues" by WARMUP::GUPTA () Mon Jan 30 1989 06:52

I am having problems with the get_something routine that is defined in the 
DEcburger exapmle.

When I invoke the get_something routine I cannot get the returning string 
to print it on the terminal.
the returning value of the string is "garbag" if you can see what I am doing 
wrong or suggest a better method I will appreciate it .

thankyou in advance



delclartions are given below:

(
   I am trying to access the title of the popup_dialog_box
  
   The reason for getting the title is to ......
      In my application there are more one popup_dialog_box is managed by
      several push_buttons in the pull_down_menu
      I have changed  the title of the popupdialog box each time the 
      popup_dialog_box is called by a push_button
   eg       push_button delete manages common_popup_dialog_box
            title delete an entry in the database 
      second push_button
            push_button insert manages common_popup_dialog_box
           title insert an entry in the database
      
  for the push_buttons associated with the common_popup_dialog_box different
 managament of wigdet is required so I  am testing the title of the each
 common_popup_dialog_box to test and then manage the particular widget      

)


static int
initialize_application ()
/*==========================================================================
** Application initialization routine.  This routine does all the one-time
**	 setup of application variables.
**
** Parameters:								   */
/*	NONE								   */
/*
**
**-------------------------------------------------------------------------*/
{

    /*
     * initialize the application data structs
     */                                                            
    latin_insert  = DwtLatin1String("Insert an entry in the database"); 
    latin_delete  = DwtLatin1String("Delete an entry in the database"); 
    latin_edit    = DwtLatin1String("Edit an entry in the database"); 
    latin_veiw    = DwtLatin1String("Veiw an entry in the database"); 
    latin_space   = DwtLatin1String(" "); 

}

 DwtCompString latin_insert; 
 DwtCompString latin_delete; 
 DwtCompString latin_edit; 
 DwtCompString latin_veiw; 
 DwtCompString latin_space; 

/*
 * Simplified SET VALUE routine to use only when changing a single attribute.
 * If we need to change more than one, all new values should be put 
 * into one arglist and we should make one XtSetValues call (which is MUCH 
 * more efficient).
 */

static void set_something(w, resource, value)
    Widget w;
    char *resource, *value;
{
    Arg al[1];

    XtSetArg(al[0], resource, value);
    XtSetValues(w, al, 1);
}


/*
 * Simplified GET VALUE routine to use only when retrieving a single attribute.
 * If we need to retrieve more than one, all values should be put 
 * into one arglist and we should make one XtGetValues call (which is MUCH 
 * more efficient).
 */

static void get_something(w, resource, value)
    Widget w;
    char *resource, *value;
{
    Arg al[1];

    XtSetArg(al[0], resource, value);
    XtGetValues(w, al, 1);
}

void
nc_activate_proc(w,object_index,callbackdata)
/*==============================================================================
**  This routine handles the activate callback functions
**	for any object.
**
** Parameters:
*/
    Widget	w;
    int		*object_index;
    DwtAnyCallbackStruct	*callbackdata;
/*
**----------------------------------------------------------------------------*/
{
/* variable declare */
char y[70]; 
 
/* this routine is to test the widget is managed or not and print error message
 * is it cannot be fetched   
 * set something will set the title of the popup dialog box
 * set something 2 will set the popup dialog box to be dwtmodal
 * this routine works  
*/
    
	case	k_g_delete_Btn_26:
	  {
            util_fetch_manage_pop_to_top(&ra_object_ids[k_nc_delete_Popdialog],
	        "delete_Popdialog",ar_DRMHierarchy,ar_toplevel_object);
            set_something(ra_object_ids[k_nc_delete_Popdialog],DwtNtitle,
                          latin_delete);
            set_something(ra_object_ids[k_nc_delete_Popdialog],DwtNstyle,
                          DwtModal);
	    break;

	case	k_nc_insert_Btn_27:
	{

         get_something(ra_object_ids[k_nc_delete_Popdialog], DwtNtitle, y);
         printf("get_something_text_is....  %s\n", y );
 
/* the printf statement doesnot print the text string that it should contain */
          

         }







T.RTitleUserPersonal
Name
DateLines
62.1QUARK::LIONELAd AstraMon Jan 30 1989 09:445
What you are "getting" is a compound string.  You can't just do a printf of
it.

			Steve

62.2how to printf compound stringWARDER::GUPTAMon Jan 30 1989 09:576
    If I cannot do a printf to a compound string is there a way of copying
    the string into anouther char variable so that I can printf the
    variable
    
    thanks

62.3Can I close the call now ?COMICS::BELLMirror or window ?Mon Jan 30 1989 10:3010
    Arun,

    I believe that calling DwtInitGetSegment followed by a loop of
    DwtGetNextSegment until it returns DwtEndCS should unpack the
    compound string one element at a time.

    Frank Bell
    UKTSC Basingstoke