×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    47

    Unhappy How to modify a form-field?

    Hello,
    i've created a simple form:
    Code:
    f1=appuifw.Form([(u'Type: ','text'),(u'Lat: ','text'),(u'Long : ','text'),(u'Time: ','text')],appuifw.FFormViewModeOnly)
    f1[0].setText("Default_type")
    f1.execute()
    in oder to modify the content of the 1st field in the form, but i've got the error:
    "AttributeError: 'tuple' object has not attribute text".
    Why?
    Isn't it a "text field"?
    Please, help me.
    Thank you

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: How to modify a form-field?

    Quote Originally Posted by giapage View Post
    Hello,
    i've created a simple form:
    Code:
    f1=appuifw.Form([(u'Type: ','text'),(u'Lat: ','text'),(u'Long : ','text'),(u'Time: ','text')],appuifw.FFormViewModeOnly)
    f1[0].setText("Default_type")
    f1.execute()
    in oder to modify the content of the 1st field in the form, but i've got the error:
    "AttributeError: 'tuple' object has not attribute text".
    Why?
    Isn't it a "text field"?
    Please, help me.
    Thank you
    OK, so the error is "'tuple' object has no attribute setText". That's because you are trying to change the text in f1's first element, which is a tuple, not a text field, or any kind of field for that matter.

    I suggest you do something like this:
    Code:
    x="Type"
    
    f1=appuifw.Form([(u'%s: ' % x,'text'),(u'Lat: ','text'),(u'Long : ','text'),(u'Time: ','text')],appuifw.FFormViewModeOnly)
    x="Default_type"
    f1.execute()

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    47

    Re: How to modify a form-field?

    It seems that i solved the problem using:

    f1[0]=(u'Type: ','text',u'myText')
    f1.execute()

    but now the problem is that the function that upload the value in the form is a thread.
    If i use execute() i have always to click on menu "Back" and it's quite annoying. Is there another way to make the update of value not depending on the user click?
    Thank you
    Last edited by giapage; 2008-04-16 at 18:31.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to modify a form-field?

    hi giapage

    sorry to say can u make your problem bit more clear to the forum. so we can help you more.
    thanks

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    47

    Re: How to modify a form-field?

    Quote Originally Posted by gaba88 View Post
    hi giapage

    sorry to say can u make your problem bit more clear to the forum. so we can help you more.
    thanks
    I've developed an application that get data from a GPS of N95 and everytime that it get new data i want to show the new value of latitude or longitude (for example) in the same form.
    Is it possible to do something like this or should i use a canvas?

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to modify a form-field?

    hi giapage
    the idea is nice. Its advisable to use canvas for this approach. If u want to use the form store the Data received from the GPS in a variable and use that variable to display it in the form.
    i hope i got your question.
    plz give a feedback.
    best regards.

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    47

    Re: How to modify a form-field?

    Hello gaba88,
    Quote Originally Posted by gaba88 View Post
    hi giapage
    the idea is nice. Its advisable to use canvas for this approach. If u want to use the form store the Data received from the GPS in a variable and use that variable to display it in the form.
    i hope i got your question.
    plz give a feedback.
    best regards.
    probably i'll use a canvas but sincerly i cannot understand how to use a variable to modify the value of the form fields.
    Actually i have already that variable with is updated by the GPS value but what i don't know how to show the value of this variable on the form.
    If i use:

    Code:
    f1[0]=(u'GPS data: ','text',gps_data_value)
    it doesn't work.
    I tried to modify it in:
    Code:
    f1[0]=(u'GPS data: ','text',gps_data_value)
    f1.execute()
    and in such case it works but before to update the form field-value i have to click on the menu "back"...and it's quite annoying!
    I hope that you can help me

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to modify a form-field?

    hi giapage
    really sorry that you are stuck up with your application.
    I observed that the method i suggested you, you already have tried that are the values in the form not changing or you are getting an error.
    waiting for your feedback

  9. #9
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: How to modify a form-field?

    Quote Originally Posted by giapage View Post
    how to use a variable to modify the value of the form fields.
    Actually i have already that variable which is updated by the GPS value but what i don't know how to show the value of this variable on the form.
    You need to redraw the screen to show that variable value has been changed. Have you implemented for example redraw_callback for appuifw.Canvas? I don't think that changing the value of variable is enough to make screen upadte?

    Wondering,

    --jouni

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to modify a form-field?

    hi jouni
    infact you are correct that by assigning variables its not possible to update the value and the method suggested by you is correct and already implemented what about changing the particular field in a form.
    thanks

  11. #11
    Registered User
    Join Date
    Feb 2008
    Posts
    47

    Re: How to modify a form-field?

    Hi guys.
    Thank you for your advice.
    Quote Originally Posted by JOM View Post
    You need to redraw the screen to show that variable value has been changed. Have you implemented for example redraw_callback for appuifw.Canvas? I don't think that changing the value of variable is enough to make screen upadte?
    but i would like to remember that i was trying to use a Form instead of a Canvas. Is it possible to do something like "Redraw" even to a Form?
    Sincerly now, i'm addressing toward use of canvas because at this point a think that it's not possible to do it by a Form but if it is, please let me know.
    Bye

  12. #12
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: How to modify a form-field?

    Quote Originally Posted by giapage View Post
    use a Form instead of a Canvas. Is it possible to do something like "Redraw" even to a Form?
    Form is a dialog. As far as I know the only way to refresh a dialog is to execute() it. However if you have Canvas below it and call redraw_callback yourself, then it just might also force redraw of the dialog

    Maybe you could do one more experiment: you now use flag "FFormViewModeOnly", which disables editing of form fields. What if you change to "FFormEditModeOnly" and allow editing? Any change?

    In any case I still believe that for dialog screen update you have to close & execute - or switch to Canvas or Text. Dialog as app user interface is not really recommended (at Symbian C++ department).

    Cheers,

    --jouni

  13. #13
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to modify a form-field?

    hi giapage again
    if you want to make a updated screen use canvas method. or try the execute() function of the dialog methods.
    thanks

Similar Threads

  1. Form troubles
    By matdodgson in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-12-06, 10:49
  2. How to assign a value to a form field?
    By bandz_fab in forum Symbian
    Replies: 2
    Last Post: 2006-11-10, 23:05
  3. field not modified in form
    By silviuccia in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-09-01, 11:10
  4. adding field in form
    By cristoforo in forum Symbian
    Replies: 1
    Last Post: 2006-05-24, 09:45
  5. popup form field
    By dalore in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-07-11, 03:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×