Source language: Translate to:

ComboBox doesn't update

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

ComboBox doesn't update

Postby Horst Helfen » Fri Oct 13, 2006 4:46 am

In my program I have a list shown in a ComboBox [ComboBox1].
When I browse my data the ComboBox should show the actual value.

Code: Select all
SetVar "[ComboBox1]" "[Ergebnis1]"
RefreshObject "ComboBox1"


But the ComboBox continues to show the last selected item instead of [Ergebnis1]. The debug window shows the correct value.

What can I do?
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Postby HPW » Fri Oct 13, 2006 6:20 am

Where do you put this code?

Code: Select all
SetVar "[ComboBox1]" "[Ergebnis1]"
RefreshObject "ComboBox1"


In a combobox no code is needed to set its variable!
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Gaev » Fri Oct 13, 2006 6:30 am

Horst:

I duplicated your scenario ... with the described commands in a separate button ... and I did not experience the problem you described ... perhaps you can verify/confirm ...

a) It is a ComboBox (and not a ListBox) you are working with.

b) The property Variable: (to store selected item) is also [ComboBox1]

c) The property Variable Contains is set to Item text

d) What (if any) script commands do you have in the object's Selection Changed section ? ... ditto MouseEnter and MouseExit sections.

e) After the RefreshObject command, insert this
Code: Select all
AlertBox "trace" "[ComboBox1]|[Ergebnis1]"
... so you can see that the two variables have EXACTLY the same values

f)
The debug window shows the correct value.
... can you elaborate ? ... which variable(s) ?


P.S. What does [Ergebnis1] translate to in English ?
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby HPW » Fri Oct 13, 2006 7:19 am

P.S. What does [Ergebnis1] translate to in English ?

[Result1]
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Horst Helfen » Sat Oct 14, 2006 3:42 am

Hans-Peter,

Where do you put this code?
...
In a combobox no code is needed to set its variable!

I have an input form
Image
In the combobox I have a list of latin names to select a plant which then will show with its appropriate entries in the form. That's no problem. At the left bottom of the form I have some buttons to browse the plants. Their entries are then shown in the form - no problem either. Only the combobox doesnt show the new value.
In the shown example the entry Actinidia delicosa (like in the field Lateinischer Name in the upper left) should appear in the combobox - but it doesn't!
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Postby HPW » Sat Oct 14, 2006 4:22 am

At the left bottom of the form I have some buttons to browse the plants.


Then you must show their code.
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Horst Helfen » Sat Oct 14, 2006 5:47 am

Hans-Peter,

I presented the code snippet in my opening of this topic.

Here is the complete action code of the forward button:
Code: Select all
FileLen "[datei]" "[laenge]"
If "[i]" "<" "[laenge]"
  Math "[i]+1" "0" "[i]"
Endif
FileRead "[datei]" "[i]" "[datensatz]"
SetVar "[text]" "[datensatz]"
gosub "convert"
SetVar "[datensatz]" "[text]"
StrParse "[datensatz]" "+++" "[Ergebnis]" "[nr]"
gosub "kategorien"
SetVar "[ComboBox_auswahl]" "[Ergebnis1]"
RefreshObject "ComboBox_auswahl"

where i is the number of the actual plant. This is increased by one and the appropriate line of the file containing the data is read. The subroutine convert converts some special characters from HTML code to ANSI. The data fields in the text file are separated by +++. This line then is split and the array [Ergebnis] contains the different fields. [Ergebnis1] contains the latin name (which it really does as I can watch in the debug window and the field Lateinischer Name is correctly filled with [Ergebnis1]). But the combo box remains unchanged. Why?
Below the definition of the ComboBox:
Image
I changed the Variable contains from item number to item text - no change.
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Postby HPW » Sat Oct 14, 2006 5:56 am

Shoudn't it be:

Code: Select all
SetVar "[latname]" "[Ergebnis1]"
RefreshObject "ComboBox_auswahl"
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Horst Helfen » Sat Oct 14, 2006 6:25 am

I forgot to mention that I already had tested this, but without any result.
I even compiled the pub and tested it with the compiled program which didn't change anything.
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Postby HPW » Sat Oct 14, 2006 6:36 am

Do you test it together with the setting: Variable contains item text

SetVar "[latname]" "[Ergebnis1]"

Are you sure there is no mis-spelling and no additional space in front or back of the string. Make sure that it is equal.
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Horst Helfen » Sat Oct 14, 2006 6:45 am

That did it! I thought I already had tested this combination but was obviously wrong. Thank you very much, Hans-Peter!
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest