External libraries
Posted
#1
(In Topic #497)
Guru

I'm trying to figure out how to use a library function but am clueless really
I want to use the XKeycodeToKeysym() command from the Xlib
I tried this..
Extern XKeycodeToKeysym(Disp As Object, code As Integer, Index As Integer) As String In "Xlib"
That does not work. says cannot find xlib.so
fumbling around in the dark here
Any clues would be appreciated.
Tia.
Bruce.
Posted
Regular

BruceSteers said
…I'm trying to figure out how to use a library function…
I think you are missing the Library declaration, take a look at my post: Captain Bodgit: Gambas: using external C libraries
In the meantime I'll take a look at xlib
Posted
Regular

…we just got to figure out how to reference it
Posted
Guru

thank you , i can play with that now, just gotta work out how to pass the args like "Display"
Posted
Regular

BruceSteers said
…just gotta work out how to pass the args like "Display"
I don't know if you have already found this: /howto/extern - Gambas Documentation
I think the Display argument is a pointer.
Good luck Bruce.
Posted
Regular

Yes, he has to use a Pointer data type.stevedee said
I think the Display argument is a pointer.
Here a few years ago I wrote some examples (text in italian) using the external functions of the <COLOR color="#800000">X11</COLOR> library in Gambas:
Creare una finestra mediante le funzioni del API di X11 - Gambas-it.org - Wikipedia
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

stevedee said
BruceSteers said
…just gotta work out how to pass the args like "Display"
I don't know if you have already found this: /howto/extern - Gambas Documentation
I think the Display argument is a pointer.
Good luck Bruce.
Yes, cheers , been reading up where i can. heading into C world though , so much more complex than basic lol.
Definitely giving me a headache :-\
I may just blow it all out and make my app gtk only.
Key codes all seem fine and match keysymdef.h file on GTK , QT though , pah
Posted
Regular

BruceSteers said
….heading into C world though , so much more complex than basic…
Ideally, everyone should learn C.
Even if you never use it, having that background information is very useful when working with other languages and operating systems.
Definitely giving me a headache :-\
lol, try C++ for a full blown migraine!
Posted
Regular

vuott said
…Here a few years ago I wrote some examples (text in italian) using the external functions of the <COLOR color="#800000">X11</COLOR> library in Gambas:
Creare una finestra mediante le funzioni del API di X11 - Gambas-it.org - Wikipedia
These are great examples vuott, and what a brilliant Gambas wiki!
Posted
Guru

I thought i was doing it right, i used the opendisplay command using Pointers then tried to use the function i wanted, then closedisplay.
Just got a segmentation 11 fault each time
But i found a work-around for now to get my macro recorder working (mostly) on QT.
I just have one little issue to deal with with a menu shortcut to play the macro.
On GTK if i hit F7 to play the macro and the macro calls a F3 (search) hit, it runs where it should.
On QT it seems the F3 hit does not get sent till all the macros have played out. (i'm guessing i'm locked in the KeyPress() function and the F3 hit does not function till out of the KeyPress function.) annoying as it does not happen on GTK just QT.
But thanks for the links guys , useful resources for me to look at if i try again
All the best
Bruce
Posted
Regular

stevedee said
These are great examples vuott, and what a brilliant Gambas wiki!
Thank you so much, stevedee !
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Regular

stevedee said
Ideally, everyone should learn C.
Even if you never use it, having that background information is very useful when working with other languages and operating systems.
I'm perfectly agree ! :!:
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

C always seems "full of rubbish" to me lol
Basic has it's fair share of rubbish with defining things but C , phew, talk about fussy , and a rubbish compiler. The AmigaE language and compiler took loads of the work out of it
I've dabbled with perl java php vb , since but after moving over to linux and discovering gambas I stopped looking any further.
It's only now that i've gotten so deeply into gambas that im having to deal with C again.
I'm really digging being able to fork/clone it and have a version i can monkey around with
There's a couple of issues i have with the latest version (mostly it killing my test arg lists in the .project files)
I fixed that bug and sent a merge request but Benoít didn't bite.
Even tried editing the code on the the gambas gitlab page and having git auto create a branch set to delete on merge. but he still didn't bite.
I sent a mail the the M/L pleading for him to fix it as it was driving me mad every time i loaded a project in an older gambas it would delete my arg lists :evil: .
It may seem trivial but my GUI builder GForm has an args list like this…
I once said
ArgumentList=[["end","tgbutton="tb1|This is a ToggleButton|on nostretch"","box","input="i1|some text=this"","unbox","box","toolbutton="tb2|Goodbye"","fontbox="FBX||stretch linkto=list1"","unbox","button="b4|well then|noclose|com=xdg-open /home"","box","label="|This ia a label\na 2 line label"","input="in3|more txt"","unbox","box","checkbox="cb1|Check box this|on background=200,230,230"","combobox="cmb1|l1,list 2,the third"","unbox","list="list1|l1,list 2,the third|1|lines=3"","box","maskbox="msk1|the mask"","button="BQ|Quit|stretch"","unbox","width=300","pipe=/tmp/fifo1","listen=/tmp/fifo2"],["return=end","listen=/tmp/fifo2","bg=200,200,100","label="lbl|testin\nthis label|stretch"","menu="mMain|form|Main Menu"","menu="m2|mMain|Open|icon=open toggle"","menu="m3|mMain|Close|icon=close"","menu="m4|mMain|Quit|icon=quit close"","box","button=0|Yes","button=1|no","button="2|Cancel|picture=cancel menu=mMain"","unbox","textbox="tb1|something|nostretch"","tgbutton="tgb|tgbutton|on"","pipe=/tmp/fifo1"],["help"],["button="b1|Button 1|icon=open|com=xed /media/bonus/Elements/LinuxStuff/GForm_dist/install/Install_GForm.sh"","button="|testing 1 2 3|tip=trying this\rtip here"","button="|CLose|close""],["allstretch","label="lbl|Test Menu Window"","menu="mMain|form|Main Menu"","menu="mItem|mMain|Menu Item|com=xed"","box","button="bt1|Button 1|menu=mMain icon=menu|shell=gambas3|tip=Click to run gambas3 IDE"","button="|Quit|icon=quit close""]]
<HR>[hr]</HR>
But then it hit me.
I have a clone on my hard drive, i edit the code myself and gambas updates now merge into my clone. leaving my changes be.
That's kinda excellent
I just have to be careful not to make my apps (that others could use) only work on my gambas.
But you can see a definite crossover point in gambas where it goes from gambas code to C , sigh
I guess I'm just a basic guy
1 guest and 0 members have just viewed this.


