[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

764.0. "Specifying widget class in FORTRAN?" by CSC32::K_TICE (Ada...Keeping the world safe for beaurocracy!) Wed May 10 1989 20:07

    I'm afraid I need to ask a silly question.  In FORTRAN, how do you
    specify a widget class?
    
    For example, in XtCreateApplicationShell, how would I specify 
    topLevelShellwidgetClass ??
    
    In sys$library:decw$dwtdef.for there is a record called 
    toplevelshellclassrec.  There is also toplevelshellwidgetclass
    declared as an INTEGER*4, but it is never set to anything!
    
    I know dealing with pointers in FORTRAN is "interesting"?
    I pretty sure that is what is going on here, but HOW DO YOU USE
    THESE THINGS?????   HOW TO THE GET VALUES IN THEM?!
    

    Thanks!

    Ken

T.RTitleUserPersonal
Name
DateLines
764.1...CLASS is a reference to DECW$DWTLIBSHRSDSVAX::SWEENEYPatrick SweeneyWed May 10 1989 21:38109
    An answer to one of your direct questions.  Following a <FF> are the
    global symbols of SYS$SHARE:DECW$DWTLIBSHR.EXE with "CLASS".  These
    symbols are defined there.  Your FORTRAN program references them. 
    "CLASS" is a pointer and "CLASSREC" is the record itself.
    
    For your indirect question: FORTRAN is a language which doesn't have
    support for many things.  One of the benefits of VMS is the VMS calling
    standard and run time libraries which allow an application to select
    the most appropriate language for a module.
    
		symbol: "APPLICATIONSHELLCLASSREC"
		symbol: "APPLICATIONSHELLWIDGETCLASS"
		symbol: "ATTACHEDDBWIDGETCLASS"
		symbol: "ATTACHEDDBWIDGETCLASSREC"
		symbol: "COMMANDWIDGETCLASS"
		symbol: "COMMANDWIDGETCLASSREC"
		symbol: "COMPOSITECLASSREC"
		symbol: "COMPOSITEOBJECTCLASS"
		symbol: "COMPOSITEOBJECTCLASSREC"
		symbol: "COMPOSITEWIDGETCLASS"
		symbol: "CONSTRAINTCLASSREC"
		symbol: "CONSTRAINTWIDGETCLASS"
		symbol: "DIALOGWIDGETCLASS"
		symbol: "DIALOGWIDGETCLASSREC"
		symbol: "DWT$REGISTER_CLASS"
		symbol: "DWTCOMMONWIDGETCLASS"
		symbol: "DWTCOMMONWIDGETCLASSREC"
		symbol: "DWTDRMCWRSETCLASS"
		symbol: "DWTDRM__WCI_GETCLASSDESCOFCLREC"
		symbol: "DWTDRM__WCI_GETCLASSDESCRIPTOR"
		symbol: "DWTDRM__WCI_REGISTERCLASS"
		symbol: "DWTHELPWIDGETCLASS"
		symbol: "DWTHELPWIDGETCLASSREC"
		symbol: "DWTREGISTERCLASS"
		symbol: "FILESELECTIONWIDGETCLASS"
		symbol: "FILESELECTIONWIDGETCLASSREC"
		symbol: "HELPSHELLWIDGETCLASS"
		symbol: "HELPSHELLWIDGETCLASSREC"
		symbol: "HIDDENSHELLWIDGETCLASS"
		symbol: "HIDDENSHELLWIDGETCLASSREC"
		symbol: "LABELGADGETCLASS"
		symbol: "LABELGADGETCLASSREC"
		symbol: "LABELWIDGETCLASS"
		symbol: "LABELWIDGETCLASSREC"
		symbol: "LISTBOXWIDGETCLASS"
		symbol: "LISTBOXWIDGETCLASSREC"
		symbol: "MAINWINDOWWIDGETCLASS"
		symbol: "MAINWINDOWWIDGETCLASSREC"
		symbol: "MENUPOPUPCLASSREC"
		symbol: "MENUPOPUPWIDGETCLASS"
		symbol: "MENUWIDGETCLASS"
		symbol: "MENUWIDGETCLASSREC"
		symbol: "MESSAGEWIDGETCLASS"
		symbol: "MESSAGEWIDGETCLASSREC"
		symbol: "OBJECTCLASS"
		symbol: "OBJECTCLASSREC"
		symbol: "OVERRIDESHELLCLASSREC"
		symbol: "OVERRIDESHELLWIDGETCLASS"
		symbol: "PULLDOWNWIDGETCLASS"
		symbol: "PULLDOWNWIDGETCLASSREC"
		symbol: "PUSHBUTTONGADGETCLASS"
		symbol: "PUSHBUTTONGADGETCLASSREC"
		symbol: "PUSHBUTTONWIDGETCLASS"
		symbol: "PUSHBUTTONWIDGETCLASSREC"
		symbol: "RECTOBJCLASS"
		symbol: "RECTOBJCLASSREC"
		symbol: "SCALEWIDGETCLASS"
		symbol: "SCALEWIDGETCLASSREC"
		symbol: "SCROLLWIDGETCLASS"
		symbol: "SCROLLWIDGETCLASSREC"
		symbol: "SCROLLWINDOWWIDGETCLASS"
		symbol: "SCROLLWINDOWWIDGETCLASSREC"
		symbol: "SELECTIONWIDGETCLASS"
		symbol: "SELECTIONWIDGETCLASSREC"
		symbol: "SEPARATORGADGETCLASS"
		symbol: "SEPARATORGADGETCLASSREC"
		symbol: "SEPARATORWIDGETCLASS"
		symbol: "SEPARATORWIDGETCLASSREC"
		symbol: "SHELLCLASSREC"
		symbol: "SHELLWIDGETCLASS"
		symbol: "STEXTWIDGETCLASS"
		symbol: "STEXTWIDGETCLASSREC"
		symbol: "TEXTWIDGETCLASS"
		symbol: "TEXTWIDGETCLASSREC"
		symbol: "TOGGLEBUTTONGADGETCLASS"
		symbol: "TOGGLEBUTTONGADGETCLASSREC"
		symbol: "TOGGLEBUTTONWIDGETCLASS"
		symbol: "TOGGLEBUTTONWIDGETCLASSREC"
		symbol: "TOPLEVELSHELLCLASSREC"
		symbol: "TOPLEVELSHELLWIDGETCLASS"
		symbol: "TRANSIENTSHELLCLASSREC"
		symbol: "TRANSIENTSHELLWIDGETCLASS"
		symbol: "VENDORSHELLCLASSREC"
		symbol: "VENDORSHELLWIDGETCLASS"
		symbol: "WIDGETCLASS"
		symbol: "WIDGETCLASSREC"
		symbol: "WINDOWOBJCLASS"
		symbol: "WINDOWOBJCLASSREC"
		symbol: "WINDOWWIDGETCLASS"
		symbol: "WINDOWWIDGETCLASSREC"
		symbol: "WMSHELLCLASSREC"
		symbol: "WMSHELLWIDGETCLASS"
		symbol: "XT$CLASS"
		symbol: "XT$IS_SUBCLASS"
		symbol: "XT$SUPERCLASS"
		symbol: "XTCLASS"
		symbol: "XTISSUBCLASS"
		symbol: "XTSUPERCLASS"

764.2Back in the real world....QUARK::LIONELin the silence just before the dawnThu May 11 1989 18:5617
You probably need to declare the widget class symbol as EXTERNAL and use
%LOC to get its address.  I haven't played with that part of the interface
so I can't help you more.

Re: .1

The intent of XUI is to provide an application interface so that real people's
programs can get the benefits of a windowing environment.  It is unfortunate
that those who designed it wore "C" blinders and did not take into consideration
the world's most popular language for technical applications (the VAX version
of which is the #1 selling VMS layered product).

It is supreme hubris to tell people that they must use a specific language
to get the benefits of XUI.

				Steve

764.3On the right track, but...29067::K_TICEAda...Keeping the world safe for beaurocracy!Fri May 12 1989 11:5931
C	OK.  A specific example.  Why does this ACCVIO on the call to
C	create_application_shell ???
C	
C	Making TOPLEVELSHELLWIDGETCLASS external and passing a %LOC
C	of it does not work either (ACCVIOs at different address).
C	
C	What am I missing?
C
C
	program shell

	implicit none
	include 'SYS$LIBRARY:DECW$DWTDEF.FOR'
	integer*4 ac, toplevel, text, middle
	record /dwt$arg/ arg_list(0:10)
	character*6 howdy(42) /42*'Howdy '/

	ac = 0 
	toplevel = xt$initialize('Example', 'EXAMPLE', 0, 0, ac, 0)
	middle = xt$create_application_shell('Example 2',
	1	toplevelshellwidgetclass, arg_list, 0)

	text = dwt$s_text(middle, 'TEXT', 0, 0, 75, 3, howdy)

	call xt$manage_child(middle)
	call xt$manage_child(text)
	call xt$realize_widget(toplevel)
	call xt$main_loop()

	end

764.4Short DECwindows programs clinic32905::SWEENEYPatrick SweeneyFri May 12 1989 19:2355
For those without patience, here's the summary:

  (1) Be sure the argcount to XtInitialize is modifiable by the toolkit

  (2) The shell that is the result of XtCreateApplicationShell has no parent,
      therefore XtManageChild is meaningless (and erroneous).  You must use
      XtRealizeWidget with such widgets.

  (3) Shells need to have children before they are realized (else they will be
      assigned width and height of zero which will generate many X errors)

  (4) A shell that never obtains a children can never be realized for the
      same reason as (3)
   
Here's the literal translation of your program in C:
(It doesn't run, it ACCVIO's)

#include <X11/DwtAppl>
main () {
    int ac = 0;
    Widget toplevel, middle, text;
    Arg arg_list[1];
    char *howdy = {"Howdy"};

	toplevel = XtInitialize("Example", "EXAMPLE", 0, 0, ac, 0);
        middle = XtCreateApplicationShell("Example 2",
         topLevelShellWidgetClass, arg_list, 0);
        text = DwtSText(middle, "TEXT", 0, 0, 75, 3, howdy);

        XtManageChild(middle);
        XtManageChild(text);
        XtRealizeWidget(toplevel);
        XtMainLoop();
}

Here's the working version

#include <X11/DwtAppl>
main () {
    int ac = 0;
    Widget toplevel, middle, text;
    Arg arg_list[1];
    char *howdy = {"Howdy"};

	toplevel = XtInitialize("Example", "EXAMPLE", 0, 0, &ac, 0);
        middle = XtCreateApplicationShell("Example 2",
         topLevelShellWidgetClass, arg_list, 0);
        text = DwtSText(middle, "TEXT", 0, 0, 75, 3, howdy);
        XtManageChild(text);

        XtRealizeWidget(middle);
        /* XtRealizeWidget(toplevel); */
        XtMainLoop();
}

764.5Thanks, but how does one know this?29067::K_TICEAda...Keeping the world safe for bureaucracy!Mon May 22 1989 13:0110
    Thanks for the reply.  This is what I need to know ... but, just where
    exactly is this documented in such clear and concise terms?   I hope
    it is not assumed that all this is "obvious" to a programmer new to X,
    'cause it is not!
    
    Sorry for the delay in this reply, I just got back from vacation!
    
    Thanks again,
    Ken

764.6FORTRAN still does not work!29067::K_TICEAda...Keeping the world safe for bureaucracy!Mon May 22 1989 13:4536
C
C	Back to the original question.
C	This is a translation of the working C example to FORTRAN
C	*IT STILL DOES NOT WORK*.  As I said before it access violates
C	at the call to create applications shell.   It never reaches 
C	the code that does the realization.
C	
C	Again, making TOPLEVELSHELLWIDGETCLASS external an passing a %loc
C	does not work either!  It still gives an ACCVIO on the call to 
C	create application shell, but thr accvio is at a different address.
C	
C	Something is fishy here!
C
C
	program shell_2

	implicit none
	include 'SYS$LIBRARY:DECW$DWTDEF.FOR'
	integer*4 ac, toplevel, text, middle
	record /dwt$arg/ arg_list(0:10)
	character*6 howdy(42) /42*'Howdy '/
CCC	external toplevelshellwidgetclass

	ac = 0 
	toplevel = xt$initialize('Example', 'EXAMPLE', 0, 0, ac, 0)
	middle = xt$create_application_shell('Example 2',
	1	toplevelshellwidgetclass, arg_list, 0)

	text = dwt$s_text(middle, 'TEXT', 0, 0, 75, 3, howdy)

        call Xt$Realize_Widget(middle)
	call xt$manage_child(text)
	call xt$main_loop()

	end

764.7Still waiting!29067::K_TICEAda...Keeping the world safe for bureaucracy!Tue May 30 1989 10:332
    I STILL DO NOT HAVE AN ANSWER!  Why does this not work from FORTRAN!

764.8Why you may be waiting a long time32905::SWEENEYGotham City&#039;s Software ConsultantTue May 30 1989 11:0816
    Steve Lionel and Patrick Sweeney are not maintainers of DECwindows nor
    are they in your management chain. They are trying to help you and
    others who enter notes into this conference.
    
    There may be a misunderstanding here about the nature of VAX Notes: it
    is a informal support network.  Speaking for myself, I thank the
    engineers who helped me using Notes, but I understood that as an
    internal user, the QAR system was the correct channel for getting a
    formal, managed, and focused set of resources to look at a problem.
    
    Others may have a more complex map for for problem resolution but
    here's mine: (a) internal problem => QAR, (b) customer problem => have
    the customer contact their CSC (they manage the escalation), (c) crisis
    => convince a Unit- or District-level manager it's a crisis and let him
    or her take ownership.

764.9I hear and understand, BUT...29067::K_TICEAda...Keeping the world safe for bureaucracy!Tue May 30 1989 14:1632
    I understand what you are saying.
    I understand the purpose of VAX NOTES.
    Likewise, I understand the purpose of the QAR process.  
    
    But, I am at the point where I cannot even determine if this IS a PROBLEM!  
    Perhaps it is just my misunderstanding of how to use the FORTRAN 
    interface to DECwindows?
    
    I _am_ the CSC.  I have had as much exposure to DECwindows as anyone
    on my team, save two people.  One of those is an experienced FORTRAN
    person.  Neither of them know how to make this work either!
    
    The example I have posted here is an indirect result of a customer 
    problem. 
    
    The real question is larger in scope.  The documentation in this area 
    (how to use DECwindows from FORTRAN, or any language other than C)
    is, to say the least, inadequate.  From all resources I have available
    to me, I cannot tell if this REALLY is a PROBLEM.  That being the case,
    how can I justify submitting a QAR or SPR?  It does not help anyone to
    flood the system with bogus problem reports!
    
    If I am left with no alternative, I will do just that.  
    ...BUT I DID NOT THINK THAT THIS WAS THAT DIFFICULT A QUESTION!
    
    The question still can be stated very simply: "How does one specify a 
    widget class in FORTRAN?"
    
    
    
    Ken

764.102082::LIONELin the silence just before the dawnTue May 30 1989 15:507
I've determined so far that the widget class is a pointer by reference, so
it seems that %LOC(topLevelShellWidgetClass) is what you need.  However,
it still ACCVIOs for me in a different place.  I'll look at it some more
when I get a chance.

				Steve

764.11I got it....QUARK::LIONELin the silence just before the dawnTue May 30 1989 17:1952
Ok, I think I got to the bottom of this.  We have a combination of user
errors plus documentation errors (which may be toolkit bugs) 

By the way, my reply .10 is incorrect, but I can't
delete it anymore (BULOVA's node database must be back).

Here is a "correct" version of the program in FORTRAN:

	program shell_2

	implicit none
	include 'SYS$LIBRARY:DECW$DWTDEF.FOR'
	integer*4 ac, toplevel, text, middle
	record /dwt$arg/ arg_list(0:10)
	character*6 howdy(42) /42*'Howdy '/
	external toplevelshellwidgetclass

	ac = 0 
	toplevel = xt$initialize('Example', 'EXAMPLE', %VAL(0), 
	1 0, ac, %VAL(0))
	middle = xt$create_application_shell('Example 2',
	1	toplevelshellwidgetclass, arg_list, %VAL(0))

	text = dwt$s_text(middle, 'TEXT', 0, 0, 75, 3, howdy)

	call xt$manage_child(text)
        call Xt$Realize_Widget(middle)
	call xt$main_loop()

	end


The primary things to note are:

	1.  The shell class is a simple external passed by reference.
	2.  The argcount parameter to CREATE_APPLICATION_SHELL must be
	    passed by value (contrary to the doc and the SDL)
	3.  The urlist and argcount arguments to XT$INITIALIZE are also
	    by value.
	4.  The call to XT$MANAGE_CHILD must precede the call to
	    XT$REALIZE_WIDGET (thanks, Pat).

The one peculiar thing is that your array "howdy" seems to get treated by
the VAX binding conversion routine as one big string that contains all
42 elements.  I would not have expected that.  Maybe you can just pass
howdy(1)?

You should probably QAR the doc error and maybe the thing about the string
array, unless someone wants to comment on it here.

				Steve

764.12Many ThanksCSC32::K_TICEAda...Keeping the world safe for bureaucracy!Wed May 31 1989 10:4922
    THANK YOU ... THANK YOU ... THANK YOU!

    I appreciate your time and effort, everyone!  ...and special thanks to 
    Steve.   Sorry if I came off a bit testy.  Supporting DECwindows can
    be very frustrating at times for reasons best not discussed here.
    ...and that frustration showed through, I'm afraid.


    1.	   Hmmm. "external passed by reference"  ... I do not think I ever
       	   would have thought of that!
    2 & 3. Yes, the documentation clearly says "reference" for the mechanism 
    	   for arglist and argcount for both routines! (Silly me, believing
    	   the documentation!).  I will QAR this!
    4.	   Yes, I did see this was a problem and saw how it behaved
    	   differently in the non-working and working C versions. (Even
    	   though I know next to nothing of C)
    
    
    Thanks again,
    Ken