|
Post by rikky on Apr 21, 2020 6:26:11 GMT 1
Ja, Now I was able to follow the whole thread, and solve most problems. In the thesaurus program I now have a 3.bac:49:76: error: macro "GUISET" passed 6 arguments, but takes just 4 Rik
|
|
|
Post by Pjot on Apr 21, 2020 7:56:49 GMT 1
Hi Rik, Thanks for your patience and for testing. The error you see is my bad, it comes from the change in GUISET/GUIGET which was added yesterday. Instead of having 2 or more lines of code setting properties for the same widget: CALL GUISET(gid, "*dicts", XtNlist, dict$) CALL GUISET(gid, "*dicts", XtNnumberStrings, nr)
...we can now combine them as follows: CALL GUISET(gid, "*dicts", XtNlist, dict$, XtNnumberStrings, nr)
...thereby saving some space. I already committed this change to fossil. If you do not want to download and compile BaCon again, then you can split the GUISET back to 2 separate lines, and the program should work.
Best regards Peter
|
|
|
Post by Pjot on Apr 22, 2020 20:16:10 GMT 1
All, Today I ported the Dictionary demonstration program from Xaw3d to Motif. It is a quick port, just to see if it could be done. There is an excellent Motif programming manual here. In the process, I ran into some quirks of the new GUI engine which are solved (see fossil). Please fetch the latest BaCon code before trying the below program. Note that the widgets are directly attached to each other, but this can be changed, just as font, color and so on. Motif is way more elaborate than Xaw, and seems to have been way ahead of its time Besides, it is a toolkit based on Xt and which also is widely available on the most obscure Unix versions. Anyway, the below code is the Motif program, hope it provides some leads on how to do Motif. Best regards Peter EDIT: both Xaw and Motif use a lot of properties for widget placement and relative resizing. It is clear how well window resizing and widget placement works in Xaw and Motif, something we do not have with HUG or FLTK. Instead of defining properties, we can use a resource file as well, similar as in GTK. For X based programs, this usually is placed in ~/.Xdefaults (for GTK the file is called "gtkrc"). Putting a proper Xdefaults in your home directory already would narrow down a lot of property definitions. As a side note: in Motif, it also is possible to put widgets based on position on a window. This would lead to less property settings but also to more stiff GUI's. OPTION GUI TRUE PRAGMA GUI motif
GLOBAL dict$
FUNCTION Get_Data$(server$, request$)
LOCAL total$, line$ LOCAL mynet
OPEN server$ & ":2628" FOR NETWORK AS mynet SEND request$ TO mynet
REPEAT RECEIVE line$ FROM mynet total$ = total$ & line$ IF INSTR(line$, "250 ok") THEN BREAK UNTIL NOT(WAIT(mynet, 1000))
SEND "QUIT" TO mynet CLOSE NETWORK mynet
RETURN total$
ENDFUNCTION
SUB Get_Dicts(gid)
LOCAL resp$, item$ LOCAL server TYPE char*
CALL GUIGET(gid, "server", XmNvalue, &server)
resp$ = Get_Data$(CHOP$(server), "SHOW DB" & CR$ & NL$)
FOR item$ IN resp$ STEP CR$ & NL$ IF REGEX(LEFT$(item$, 1), "[[:alpha:]]") THEN dict$ = APPEND$(dict$, 0, HEAD$(item$, 1)) CALL XmListAddItem(GUIWIDGET(gid, "dicts"), XmStringCreateLocalized(item$), 0) ENDIF NEXT
CALL GUISET(gid, "term", XmNvalue, "")
ENDSUB
SUB Lookup_Term(gid)
LOCAL resp$ LOCAL x, total TYPE int LOCAL server, term TYPE char*
CALL GUIGET(gid, "server", XmNvalue, &server) IF LEN(server) = 0 THEN EXIT SUB
CALL GUIGET(gid, "term", XmNvalue, &term) IF LEN(term) = 0 THEN EXIT SUB
CALL GUIGET(gid, "dicts", XmNitemCount, &total)
FOR x = 1 TO total IF XmListPosSelected(GUIWIDGET(gid, "dicts"), x) THEN BREAK NEXT
IF x > total THEN EXIT SUB
resp$ = Get_Data$(CHOP$(server), "DEFINE " & TOKEN$(dict$, x) & " " & CHOP$(term) & CR$ & NL$)
CALL GUISET(gid, "translation", XmNvalue, EXTRACT$(resp$, CHR$(13)))
ENDSUB
SUB Clear_Dicts(gid)
CALL XmListDeleteAllItems(GUIWIDGET(gid, "dicts")) dict$ = ""
ENDSUB
id = GUIDEFINE( " \ { type=window name=window XmNtitle=\"Thesaurus\" XmNwidth=550 XmNheight=500 } \ { type=xmFormWidgetClass name=form parent=window } \ { type=xmLabelWidgetClass name=label1 parent=form XmNwidth=100 XmNheight=30 XmNfont=\"10x20\" XmNborderWidth=0 XmNalignment=XmALIGNMENT_BEGINNING XmNleftAttachment=XmATTACH_FORM XmNtopAttachment=XmATTACH_FORM } \ { type=xmTextWidgetClass name=server parent=form XmNheight=40 XmNfont=\"10x20\" XmNbackground=\"white\" XmNleftAttachment=XmATTACH_FORM } \ { type=xmPushButtonWidgetClass name=Fetch parent=form callback=XmNactivateCallback XmNwidth=95 XmNheight=40 XmNwidth=120 XmNfont=\"10x20\" XmNrightAttachment=XmATTACH_FORM } \ { type=xmLabelWidgetClass name=label2 parent=form XmNwidth=100 XmNheight=30 XmNfont=\"10x20\" XmNborderWidth=0 XmNalignment=XmALIGNMENT_BEGINNING XmNleftAttachment=XmATTACH_FORM XmNtopAttachment=XmATTACH_FORM } \ { type=xmScrolledWindowWidgetClass name=view parent=form XmNheight=100 XmNleftAttachment=XmATTACH_FORM XmNrightAttachment=XmATTACH_FORM } \ { type=xmListWidgetClass name=dicts parent=view XtNwidth=300 XmNfont=\"10x20\" XmNbackground=\"white\" XmNleftAttachment=XmATTACH_FORM XmNrightAttachment=XmATTACH_FORM } \ { type=xmPushButtonWidgetClass name=Clear parent=form callback=XmNactivateCallback XmNwidth=95 XmNheight=40 XmNwidth=120 XmNfont=\"10x20\" XmNrightAttachment=XmATTACH_FORM } \ { type=xmLabelWidgetClass name=label3 parent=form XmNwidth=100 XmNheight=30 XmNfont=\"10x20\" XmNborderWidth=0 XmNalignment=XmALIGNMENT_BEGINNING XmNleftAttachment=XmATTACH_FORM XmNtopAttachment=XmATTACH_FORM } \ { type=xmTextWidgetClass name=term parent=form XmNheight=40 XmNfont=\"10x20\" XmNbackground=\"white\" XmNleftAttachment=XmATTACH_FORM } \ { type=xmPushButtonWidgetClass name=Lookup parent=form callback=XmNactivateCallback XmNwidth=95 XmNheight=40 XmNwidth=120 XmNfont=\"10x20\" XmNrightAttachment=XmATTACH_FORM } \ { type=xmLabelWidgetClass name=label4 parent=form XmNwidth=100 XmNheight=30 XmNfont=\"10x20\" XmNborderWidth=0 XmNalignment=XmALIGNMENT_BEGINNING XmNleftAttachment=XmATTACH_FORM XmNtopAttachment=XmATTACH_FORM } \ { type=xmScrolledWindowWidgetClass name=trans parent=form XmNscrollingPolicy=XmAPPLICATION_DEFINED XmNvisualPolicy=XmVARIABLE XmNleftAttachment=XmATTACH_FORM XmNrightAttachment=XmATTACH_FORM XmNbottomAttachment=XmATTACH_FORM } \ { type=xmTextWidgetClass name=translation parent=trans XmNrightAttachment=XmATTACH_FORM XmNfont=\"10x20\" XmNbackground=\"white\" XmNeditMode=XmMULTI_LINE_EDIT XmNeditable=False XmNwordWrap=True XmNcursorPositionVisible=False } \ { type=xmPushButtonWidgetClass name=Exit parent=form callback=XmNactivateCallback XmNwidth=95 XmNheight=40 XmNwidth=120 XmNfont=\"10x20\" XmNrightAttachment=XmATTACH_FORM XmNbottomAttachment=XmATTACH_FORM } \ ")
CALL GUISET(id, "label1", XmNlabelString, XmStringCreateLocalized("Server:")) CALL GUISET(id, "server", XmNvalue, "dict.org", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label1")) CALL GUISET(id, "server", XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, GUIWIDGET(id, "Fetch")) CALL GUISET(id, "Fetch", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label1")) CALL GUISET(id, "label2", XmNlabelString, XmStringCreateLocalized("Dictionaries:")) CALL GUISET(id, "label2", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "server")) CALL GUISET(id, "view", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label2")) CALL GUISET(id, "view", XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, GUIWIDGET(id, "Clear")) CALL GUISET(id, "Clear", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label2")) CALL GUISET(id, "label3", XmNlabelString, XmStringCreateLocalized("Lookup:")) CALL GUISET(id, "label3", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "view")) CALL GUISET(id, "term", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label3")) CALL GUISET(id, "term", XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, GUIWIDGET(id, "Lookup")) CALL GUISET(id, "Lookup", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label3")) CALL GUISET(id, "label4", XmNlabelString, XmStringCreateLocalized("Translation:")) CALL GUISET(id, "label4", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "term")) CALL GUISET(id, "trans", XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, GUIWIDGET(id, "label4")) CALL GUISET(id, "trans", XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, GUIWIDGET(id, "Exit"))
WHILE TRUE event$ = GUIEVENT$(id) SELECT event$ CASE "Fetch" CALL Get_Dicts(id) CASE "Clear" CALL Clear_Dicts(id) CASE "Lookup" CALL Lookup_Term(id) CASE "Exit" END ENDSELECT WEND
Attachments:
|
|
|
Post by bigbass on Apr 22, 2020 22:08:28 GMT 1
Hello Peter Motif has documentation wow! (latest fossil required) UPDATE WORKING! I think I was having problems with my internet connection when I posted before Thanks looks great ! much progress for the RPI Joe This is really good news we can take some of these older widgets and give them a new life and have some fun with demos this was one widget toolkit I had never used before very interesting and fun Thanks! Joe
|
|
|
Post by rikky on Apr 23, 2020 6:53:58 GMT 1
Yes, It works. And It looks and feels better, with the arrows in the sidebars. one little thing: Warning: Cannot convert string "10x20" to type FontStruct But you cannot notice this in the end result. Motif was already installed on my system, but I had to instal libmotif-dev. I noticed from the other Thesaurus program in Xaw that if I made an executable, then this executable worked even on a fresh new system without the xaw-dev and other deps installed. I could not compile the Thesaurus program anymore, but the executable still worked. Nice. Rik.
|
|
|
Post by Pjot on Apr 23, 2020 8:13:59 GMT 1
Thanks Joe and Rikky,
The font warning may be caused by a lack of the font on your system? On my installation I have installed a package called "x11-font-misc-misc-1.1.2-8.mga7.noarch.rpm" which contains the "10x20" font.
On Debian based systems it seems to be called "xfonts-base" or something like that.
To see the available X-fonts, just run the command "xlsfonts" and replace the "10x20" by something which is available on your system. Anyway, it's not more than a beautification, of course.
BR Peter
|
|
|
Post by Pjot on Apr 23, 2020 12:37:22 GMT 1
All,
So I have started to tweak an X resources file in ~/.Xdefaults which should present the Xaw and Motif widgets in an equal manner. For the font, you'll need the generic "XFree86-75dpi-fonts" or "xorg-x11-fonts-ISO8859-1-75dpi" package installed (MIT license also).
Then create a ~/.Xdefaults file and add these properties, then activate them as follows:
# xrdb .Xdefaults
The properties mentioned below now can be removed from the BaCon programs, and this will save us some space in our definitions.
If you have any other layout ideas, please let me know!
BR Peter
! Xaw3d *beNiceToColormap: False *shadowWidth: 3 *Label.shadowWidth: 0
! Coloring *background: grey75 *Text*background: white *XmText*background: white *List*background: white *XmList*background: white
! Borders *borderWidth: 1 *Box.borderWidth: 0 *Label.borderWidth: 0 *XmLabel.borderWidth: 0
! Space between widgets *horizontalSpacing: 5 *verticalSpacing: 5
! Focus highlighting *highlightThickness: 1
! Viewport *Viewport*useRight: True
! Xaw font *Font: *lucida-bold-r-*-140-*
! Motif font *renderTable: *lucida-bold-r-*-140-*
|
|
|
Post by bigbass on Apr 23, 2020 15:52:43 GMT 1
Hello Peter this is really good now! on debian the packages are all broken up in smaller packages but they all start with xfonts I had the 100dpi already but the 75dpi no sudo apt-get install xfonts-100dpi xfonts-75dpi what did it for me was the .Xdefaults nothing I tried seemed to work before doing that step a big thanks now we are getting the same results! (getting fonts correctly on the RPI3 has always been a problem) before I usually just hacked around it using XmNfont=\"fixed\" Joe
|
|
|
Post by Pjot on Apr 24, 2020 20:10:34 GMT 1
All, Earlier I mentioned the following: To obtain an item from a list I had to use a propriety Xaw function, I am investigating if this can be done in a different manner. So the GUI engine has been improved further, in such a way that it also can provide callback information. The GUIEVENT$ function now allows an optional 2nd argument to indicate that we're interested in such a value. In Xaw, a callback is passed to a C function with 3 incoming arguments: a widget, some user data, and data from the Xaw library. This incoming data is in fact a void pointer, which now will appear in the result of the GUIEVENT$ function, next to the widget name. If we then cast the pointer correctly, we can obtain the information which was passed to the callback function. The below program is adapted to demonstrate how it works. It does not need any propriety Xaw function, it only relies on property definitions and the BaCon GUI functions. In fact, the program now fully demonstrates how basic user interface functionality is supposed to be working If you want to test it, then please also use the .Xdefaults profile mentioned above. And of course the latest version of BaCon from fossil. Best regards Peter OPTION GUI TRUE PRAGMA GUI Xaw3d
' Needed globally for list GLOBAL dict$ ARRAY 1
FUNCTION Get_Data$(server$, request$)
LOCAL total$, line$ LOCAL mynet
OPEN server$ & ":2628" FOR NETWORK AS mynet SEND request$ TO mynet
REPEAT RECEIVE line$ FROM mynet total$ = total$ & line$ IF INSTR(line$, "250 ok") THEN BREAK UNTIL NOT(WAIT(mynet, 1000))
SEND "QUIT" TO mynet CLOSE NETWORK mynet
RETURN total$
ENDFUNCTION
SUB Get_Dicts(gid)
LOCAL resp$, item$ LOCAL server TYPE char* LOCAL nr
CALL GUIGET(gid, "server", XtNstring, &server)
resp$ = Get_Data$(CHOP$(server), "SHOW DB" & CR$ & NL$)
FOR item$ IN resp$ STEP CR$ & NL$ IF REGEX(LEFT$(item$, 1), "[[:alpha:]]") THEN dict$[nr] = item$ INCR nr REDIM dict$ TO nr+1 ENDIF NEXT dict$[nr] = NULL
CALL GUISET(gid, "dicts", XtNlist, dict$, XtNnumberStrings, 0) CALL GUISET(gid, "term", XtNstring, "")
ENDSUB
SUB Lookup_Term(gid, database$)
LOCAL resp$ LOCAL server, term TYPE char*
CALL GUIGET(gid, "server", XtNstring, &server) IF LEN(server) = 0 THEN EXIT SUB
CALL GUIGET(gid, "term", XtNstring, &term) IF LEN(term) = 0 THEN EXIT SUB
IF LEN(database$) = 0 THEN EXIT SUB
resp$ = Get_Data$(CHOP$(server), "DEFINE " & database$ & " " & CHOP$(term) & CR$ & NL$)
CALL GUISET(gid, "translation", XtNstring, EXTRACT$(resp$, CHR$(13)))
ENDSUB
SUB Clear_Dicts(gid)
LOCAL empty$[] = { "", NULL } CALL GUISET(gid, "dicts", XtNlist, empty$, XtNnumberStrings, 0)
ENDSUB
FUNCTION Create_Gui
LOCAL id
id = GUIDEFINE( " \ { type=window name=window XtNtitle=\"Thesaurus\" XtNwidth=550 XtNheight=500 } \ { type=formWidgetClass name=form parent=window } \ { type=labelWidgetClass name=label1 parent=form XtNwidth=100 XtNheight=30 XtNlabel=\"Server:\" XtNjustify=XtJustifyLeft XtNleft=XawChainLeft XtNright=XawChainLeft XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=asciiTextWidgetClass name=server parent=form XtNfromVert=label1 XtNeditType=XawtextEdit XtNwidth=300 XtNheight=30 XtNleft=XawChainLeft XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=commandWidgetClass name=fetch parent=form callback=XtNcallback XtNfromVert=label1 XtNfromHoriz=server XtNwidth=95 XtNheight=30 XtNlabel=\"Fetch\" XtNleft=XawChainRight XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=labelWidgetClass name=label2 parent=form XtNfromVert=server XtNwidth=150 XtNheight=30 XtNlabel=\"Dictionaries:\" XtNjustify=XtJustifyLeft XtNleft=XawChainLeft XtNright=XawChainLeft XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=viewportWidgetClass name=view parent=form XtNallowVert=1 XtNheight=100 XtNfromVert=label2 XtNleft=XawChainLeft XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=listWidgetClass name=dicts parent=view callback=XtNcallback XtNresize=1 XtNverticalList=1 XtNwidth=300 XtNleft=XawChainLeft XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=commandWidgetClass name=clear parent=form callback=XtNcallback XtNfromVert=label2 XtNfromHoriz=view XtNwidth=95 XtNheight=30 XtNlabel=\"Clear\" XtNleft=XawChainRight XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=labelWidgetClass name=label3 parent=form XtNfromVert=view XtNwidth=100 XtNheight=30 XtNlabel=\"Lookup:\" XtNjustify=XtJustifyLeft XtNleft=XawChainLeft XtNright=XawChainLeft XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=asciiTextWidgetClass name=term parent=form XtNfromVert=label3 XtNeditType=XawtextEdit XtNwidth=300 XtNheight=30 XtNleft=XawChainLeft XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=commandWidgetClass name=action parent=form callback=XtNcallback XtNfromVert=label3 XtNfromHoriz=term XtNwidth=95 XtNheight=30 XtNlabel=\"Lookup\" XtNleft=XawChainRight XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=labelWidgetClass name=label4 parent=form XtNfromVert=term XtNwidth=150 XtNheight=30 XtNlabel=\"Translation:\" XtNjustify=XtJustifyLeft XtNleft=XawChainLeft XtNright=XawChainLeft XtNtop=XawChainTop XtNbottom=XawChainTop } \ { type=asciiTextWidgetClass name=translation parent=form XtNfromVert=label4 XtNeditType=XawtextRead XtNscrollVertical=XawtextScrollWhenNeeded XtNwidth=400 XtNheight=180 XtNleft=XawChainLeft XtNright=XawChainRight XtNtop=XawChainTop XtNbottom=XawChainBottom } \ { type=commandWidgetClass name=exit parent=form callback=XtNcallback XtNfromVert=translation XtNhorizDistance=310 XtNwidth=95 XtNheight=30 XtNlabel=\"Exit\" XtNleft=XawChainRight XtNright=XawChainRight XtNtop=XawChainBottom XtNbottom=XawChainBottom } \ ")
CALL GUISET(id, "server", XtNstring, "dict.org")
trans$ = "<FocusIn>: display-caret(on)\n<FocusOut>: display-caret(off)\n<Key>BackSpace: delete-previous-character()\n<Key>Return: end-of-line()\n<Key>: insert-char()\n<Btn1Down>: select-end()" CALL GUISET(id, "server", XtNtranslations, XtParseTranslationTable(trans$)) CALL GUISET(id, "term", XtNtranslations, XtParseTranslationTable(trans$))
CALL Clear_Dicts(id)
RETURN id
ENDFUNCTION
SUB Main_Function(id)
LOCAL info TYPE XawListReturnStruct* LOCAL db$
WHILE TRUE event$ = GUIEVENT$(id, TRUE) SELECT TOKEN$(event$, 1) CASE "fetch" CALL Get_Dicts(id) CASE "clear" CALL Clear_Dicts(id) CASE "action" CALL Lookup_Term(id, db$) CASE "dicts" info = (XawListReturnStruct*)INT(VAL(TOKEN$(event$, 2))) db$ = TOKEN$(info->string, 1) CASE "exit" END ENDSELECT WEND
ENDSUB
Main_Function(Create_Gui())
|
|
|
Post by bigbass on Apr 25, 2020 2:23:56 GMT 1
Hello Peter the RPI needs this to compile still OPTION GUI TRUE PRAGMA GUI
PRAGMA LDFLAGS Xaw3d PRAGMA LDFLAGS Xmu had to increase the translation and dictionaries string to 150 it was cutting off some letters I added a few things to the Xdefaults working well! Joe
|
|
|
Post by Pjot on Apr 25, 2020 7:28:09 GMT 1
the RPI needs this to compile still OPTION GUI TRUE PRAGMA GUI
PRAGMA LDFLAGS Xaw3d PRAGMA LDFLAGS Xmu So I looked at the development package of Xaw3d for the RPI, but it seems to be broken... Because if I compare the /usr/include/X11/Xaw3d/AllWidgets.h header file on the RPI with the same file on my system, then I can see that RPI misses the following line: #include <X11/Xmu/WidgetNode.h>
This causes compilation to fail. I can make it work by changing the top of the BaCon program as follows: PRAGMA INCLUDE <X11/Xmu/WidgetNode.h> OPTION GUI TRUE PRAGMA GUI Xaw3d
Normally this should not be necessary, I do not understand why the RPI packagers left this line of code out of the header file. Noted, I will change it in my post. Thanks for testing! BR Peter EDIT: if you have installed the libXaw3dxft8-dev package then compilation works without problems, using the following code on top of the BaCon program: OPTION GUI TRUE PRAGMA GUI xaw3dxft OPTIONS -I/usr/include/X11/Xaw3dxft LDFLAGS -lXaw3dxft
|
|
|
Post by vovchik on Apr 25, 2020 10:39:37 GMT 1
Dear Peter and Joe,
Mint 19.2 (i.e. Ubuntu, AMD 64-bit) has the same problem as PI and needs the revised explicit instructions on top. I discovered that just now while setting up a new laptop.
With kind regards, vovchik
|
|
|
Post by Pjot on Apr 25, 2020 12:11:33 GMT 1
Thanks vovchik, So I found the reason of this problem, RPI uses an older release of Xaw3d (namely, version 1.5E), and in this release the needed include is missing from the "AllWidgets.h" header file. The actual latest release, as provided by the official repo from "x.org", is Xaw3d version 1.6.3. If you check this package then you'll see that the include is in there. The Mageia Linux installation I am using also has installed the latest Xaw3d release (1.6.3), and therefore, the problem does not occur for me. The previous Xaw3d release 1.6.2 already had included the correct Xmu header. This version was released back in 2012. So I am very surprised that the Debian-based distributions for RPI and Mint still use the 1.5E version released in the year 2003 Best regards Peter PS the GITLAB tree for Xaw3d is here: gitlab.freedesktop.org/xorg/lib/libxaw3d/
|
|
|
Post by Pjot on Apr 25, 2020 12:27:38 GMT 1
All, The below code is an example on how to quickly use a dialog in Xaw(3d). Just a few lines of code are needed to set it up! We can easily embed multiple of such dialogs into our code if some graphical interaction with a user is required. We can create multiple dialogs with different names and display them when necessary. Note that the GUIEVENT$ function is responsible for displaying the GUI. If we simply break the loop then the GUI disappears. Best regards Peter OPTION GUI TRUE
mydialog = GUIDEFINE( " \ { type=window name=window XtNwidth=300 XtNtitle=\"Information\" } \ { type=dialogWidgetClass name=dialog parent=window XtNlabel=\"Enter term:\" XtNvalue=\"<term>\" } \ { type=commandWidgetClass name=cancel parent=dialog callback=XtNcallback XtNlabel=\"Cancel\" } \ { type=commandWidgetClass name=submit parent=dialog callback=XtNcallback XtNlabel=\"Submit\" } \ ")
CALL GUISET(mydialog, "label", XtNjustify, XtJustifyLeft)
DECLARE data$
WHILE TRUE event$ = GUIEVENT$(mydialog) SELECT event$ CASE "cancel" BREAK CASE "submit" CALL GUIGET(mydialog, "dialog", XtNvalue, &data$) BREAK ENDSELECT WEND
PRINT "Broken the GUIEVENT loop to hide the dialog widget."
PRINT "Value is: ", data$
PRINT "Continue program here..."
Attachments:
|
|
|
Post by rikky on Apr 25, 2020 12:56:23 GMT 1
Yes, it works. As with the Ppi Buster I had to get the xfonts-75dpi Still having a Warning: Missing charsets in String to FontSet conversion. And the CALL GUIGET(mydialog, "dialog", XtNvalue, &data$) Waitts for a second click. Meaning that I have to click the Submit button twice to see the reaction. Further, I like the sidebars from motif more. Cannot imagine this kind of sidebars in the final BaCongui. I need the little pointers at the edges of the bars, to use them easily. And I think that if this XtN is used so often , why not get rid of it. It doesnt do anything usefull, as far as I can see. Like: mydialog = GUIDEFINE( " \ { type=window name=window width=300 title=\"Information\" } \ { type=dialogWidgetClass name=dialog parent=window label=\"Enter term:\" value=\"<term>\" } \ { type=commandWidgetClass name=cancel parent=dialog callback=callback label=\"Cancel\" } \ { type=commandWidgetClass name=submit parent=dialog callback=callback label=\"Submit\" } \ ") It writes easier. Rik.
|
|