Source language: Translate to:

ListBox, ComboBox

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

ListBox, ComboBox

Postby Jim Brammer » Thu Feb 07, 2002 4:02 pm

I have five names listed in alphabetical order in both of these features, the object being to allow the user to make a selection and then to be taken to the appropriate page. I have provided five separate pages each named accordingly.

I have read the NB 'help' file with regard to both of these features but I simply cannot understand what I need to do to get these features to operate in the way I would like. I have tried entering details onto the 'Selection Changed' tab under Combo Box Properties, but which ever of the five names I click on I always get taken to the last but one page of the five named.

Clearly there is something simple I haven't done, but for the life of me I cannot understand what, so any assistance would be greatly appreciated please.

Many thanks. Clive Read (registered user UK).


<hr>


Hi Clive,

use the ComboBox variable to define an action selector in the "Selection Changed" section of the ComboBox.

e.g.
The Combobox variable is [Combovariable], add as SelectionChanged Script something like:

If "[Combovariable]" "=" "Entry1"
gotopage "1"
endif

If "[Combovariable]" "=" "Entry2"
gotopage "2"
endif

If "[Combovariable]" "=" "Entry3"
gotopage "3"
endif

where EntryX is the choosed entry as text.


Gerhard



<hr>


Thank you Gerard for taking the time to reply. I can now say that I fully understand how these features work - and indeed they do for the purpose I enquired.

Bear with me if I ask for an explanation as to how the 'Mouse Enters' and 'Mouse Exit' features work.

Thank one and all for this excellent service.

Best wishes,
Clive.

polatis


<hr>


Mouse Enters will run whatever Actions that you put here when mouse cursor moves over the ListBox. Try to put an Alertbox to test it. Then when you move the mouse over it will popup.

Mouse Exits does just the opposite and will run whatever Actions when the mouse cursor moves from the ListBox.

Polaris



<hr>


Hi.. instead

Instead of using If_end statement to check the selected value of a listbox... in order to go to a particular page... use this approach:


GotoPage "Page[Number]" where Number can be string or numeric.

With this one-liner statement... you can now reduce the number of if-end... esp with 100s of items...


<hr>


Sometimes the best tips are the most obvious ones...
Got to agree, that is a great tip. Why go through all the if--endif code when it's that simple. Your idea is not limited to page numbers either. It can be used in selecting images or files or anything...

FileRead "c:\ Docs\ThisFile[listbox1].txt" "all" "[showthisfile]"

Just set up your file naming structure to match your listbox.
and make sure you check either the text result or number result in your listbox so it matches your filenames etc.

Probably a good thing to do always ask yourself, "Is there an easier way to do this?"

Thanks
Jim Brammer
 

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 2 guests