Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: GDC + weighing scale  (Read 23724 times)
Benjamin G.
Posts: 130


« on: June 16, 2014, 08:33:21 am »

Hi,

We are looking for an advice about the best way to interact with a 'weighing scale' connected on a serial port. The scale send continuously the weight and we want to try to display synchronously the received values on screen. We have already try to use the 'idle' method to refresh the screen but it's not very usefull and not sync.
It's any existing 'entry point' in GDC that we use to interact directly with a screen field ?

Any advice welcome ...

Thanks
Nuno G.
Posts: 38


« Reply #1 on: June 17, 2014, 02:38:52 pm »

Hi !
   I don't know if it helps but did you took a look into MessageServer class ? If your scale could send a predefined string before the measurements, maybe it could solve your problems.

   Best luck
   Nuno
Benjamin G.
Posts: 130


« Reply #2 on: June 17, 2014, 04:26:37 pm »

Hi,

Thanks for reply but MessageServer is not a solution for us because it's an UDP message and we can't really sync with that. For the moment we 've another windows application (delphi) that listen on com1 and send thru keyboard the value of the scale. It's work but not ideal ... A better solution, I think, could be an API in GDC that allow updating the DOM tree by sending the fieldname/fieldvalue for e.g.

Thanks
Lionel F.
Four Js
Posts: 83


« Reply #3 on: June 17, 2014, 05:58:18 pm »

Hi Benjamin,

Wouldn't it be possible to send a value to a field and to use the ON CHANGE trigger for displaying the received value each time it changes?

Best regards,
Lionel
Benjamin G.
Posts: 130


« Reply #4 on: June 17, 2014, 06:03:37 pm »

Hi,

I don't understand. How can I send a value by program to a field ? Do you have a sample ?

Thanks
Lionel F.
Four Js
Posts: 83


« Reply #5 on: June 17, 2014, 06:08:51 pm »

Hi Benjamin,

Sorry perhaps I was going too fast. Currently are you already able to retrieve the weight value inside a simple 4GL variable ?

Best regards,
Lionel 
Benjamin G.
Posts: 130


« Reply #6 on: June 17, 2014, 06:25:48 pm »

Hi,

For the moment we 've a Delphi program that's read the data flow on port COM. This program write in the clipboard the value when the weight is "stable" and then with an ON IDLE in 4gl we get the value back from the clipboard. The inconvenient of this method is that we have the latence of the ON IDLE timeout ...
Second method is that the Delphi program send the value to the GDC directly (simulating a keyboard input). The inconvenient of the method is that the focus must be on the input field ...
We don't have try yet the method with a DLL because we don't have experience with C++, but if some one have already translate the C++ structure used by 4js to communicate between GDC and the DLL in Delphi we can try this way ...
Any other ideas are welcome ...

Thanks

Reuben B.
Four Js
Posts: 1116


« Reply #7 on: June 25, 2014, 08:00:14 am »

I don't think writing your own front-end extension https://4js.com/online_documentation/fjs-gdc-manual-html/#c_gdc_FEextensions.html would necessarily be any better as that relies on the 4gl initiating the call, you want the scales to initiate the call.

I'd experiment combining your two methods.  Have the Delphi program populate the clipboard with the weight, and then have it send an obscure keyboard combination e.g. Ctrl-Shift-W, or an unused functionkey (the main thing is it is not something you would type into a field)

Your 4gl program then just needs an action that has this obscure keyboard combination or unused function key defined as an accelerator, and the on action then reads the clipboard, and passes the value in the clipboard into the weight field.

Focus won't have to be in the input field, it will just have to be in a dialog that has this action.  You would have to watch out for keyboard buffering.


Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Benjamin G.
Posts: 130


« Reply #8 on: June 26, 2014, 02:33:31 pm »

Hi,

Your suggestion about using ON ACTION seems better ...

Thanks for te advice.

Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines