G4P Library - I cant't retrive the textfield value.

edited October 2015 in Library Questions

Hi I'm using the G4P library for a GUI inteface that must show some data coming via serial . I don't have problems to write value inside the texfield using data that are inside a byte[] using the below instructions:

String sonda_F1= str(char(inBuffer[42]))+str(char(inBuffer[44]))+str(char(inBuffer[46]))+str(char(inBuffer[48]));

textfield1.setPromptText(sonda_F1); **

I've problems when I try to read what I wronte inside the textfield1 as follow :

String my_datatxt = textfield1.getText();

println("My data :" my_datatxt);**

The output show just "My data :"

I've used the same method with a lable and lable11.getText() has worked fine , Where I'm wrong ?? :(

And another thing... assuming that I'm able to read the content of textfield1 and I got a value like this "1234", how can I split these in for different character to be store inside 4 location of a byte[] ?

Thanks since now for any suggestion ! :D

Answers

  • Answer ✓

    Do not use the setPromptText use setText instead i.e.

    String sonda_F1= str(char(inBuffer[42]))+str(char(inBuffer[44]))+str(char(inBuffer[46]))+str(char(inBuffer[48]));
    textfield1.setText(sonda_F1);
    

    The prompt text is displayed inside a GTextField when it is empty of user text and is displayed in italic text. getText does NOT return the prompt text, it returns the text typed in or entered using setText

  • Thank you quark ! Is there any easy tutorial available for the G4P library available on the web ? Thanks. Roberto.

  • Is there any easy tutorial available for the G4P library available on the web?

    Only what you can find on my website. The library comes with many examples which should give you an idea of the features available for each control.

Sign In or Register to comment.