I currently make an interface for robot controlling with PhAB under QNX6.
To control the robot, the user should be able to set a trajectory, represented by several points between which the robot would follow a straight line. The preoblem is that this number of points will change between to applications.
So, in my interface, I used a PtNumericInteger widget to get the number of points. Then I thought that the easier way to manage would be to write a code linked as a callback to a button which would create a dynamic array of independant identical windows (called for example point1, point2, …, pointn) whose size would be the previous integer. In each window, there would be PtNumericFloat widget to represent the x,y,z cartesian values of eah point.
How could I manage to create such an array ?
Or is ther a simplier way to do this ?
Moreover, why can’t I compile the interface (Applications>build+run>generate>make) when using a PtNumericFloat widget, although it work whith PtNumericInteger ?
And what is the difference between “activate” and “arm” in the call back menu?
I think that’s because PtNumericFloat was put in the static version of the photon library and excluded from the shared photon library in the version of the os you are using.
What you have to do is to edit the gcc_nto*/Makefile
and to add “-Bstatic -l ph -Bdynamic” to the link lines ( LDFLAGS=… and SDFLAGS=… )
The difference is that “arm” is called on a mouse press (left button ) while “activate” is called on a mouse release ( first you arm the widget by pressing the left button mouse. The activate is called when you release the mouse button, after the arm ).
In plain english that means you need to you ‘activate’. If you use ‘arm’, the menu bar won’t work in the fashon people are accustomed to (for example, dragging the mouse along menu bar with button pressed will NOT open/close menus as you go). This is one VERY common mistake that I see in programs written by Photon beginners.
I’m still working on this interface, and I use another interface made by another student.
He seems to have written codes in order to initialize the different windows he uses in his interface, and this code seems to be generated by PhAB. For exemple, this code allows him to give the same title to all the windows in order to put datas set by the user in these windows in one common file named as the tiles. But I can’t find any widget the code files are linked to as callbacks, and I didn’t find anything about window initialization in the Help file.
So could anyone tell me if there is a special option somewhere in PhAB to initialize windows (or something like that), and how it works ?
Moreover, I would like to do an action in a code if a button is pressed(or actually released). I read in th HelpÂ file that when a button was pressed, a Ph_EV_BUT_RELEASE event was sent. So should I write “if (name_of_button=Ph_EV_BUT_RELEASE)”, or am I wrong ?
I have another question (sorry, tell me if you’re bored )
I add the code you gave me, and it worked, but it seems there is another pb whith the PtNumericFloat.
Here is my code :
But when I open affich.txt, I only obtain
whatever I type in the widgets when running the application.
Moreover I tried something :
I just added a PtNumericInteger in the window, and changed the code to write this number instead of the three previious ones. Then I obtain an integer equal to the one I type when running the application.
I don’t really need the .txt file, but I’m afraid that the other file (fwrite(gain[l],sizeof(int),1,file)) won’t be written correctly. Is there another thing to do so that PtNumericFloat would be accepted, or is there a mistake in my code (sometimes I’m quite lost whith the format in functions) ?
I’m sorry if this message is quite long, I don’t intend to flood the forum, I just tried to be precise.
hi,I have another pb with my PtNumericFloat widget
I can’t set an initial value. To be more precise, when I change the “Numeric Value” the value changes in the window, but I can’t keep it when I run my application. I regenerate and make before running, but it has no effect. Moreover, when I change the “Numeric precision”, I can see the difference when running.
Does someone know what I’m missing ?