i am asking if it is possible to have a list of questions in a listbox, but only display one question at a time?

Discussions related to Visual Prolog
jaelharrup
Active Member
Posts: 27
Joined: 18 Feb 2011 11:59

i am asking if it is possible to have a list of questions in a listbox, but only display one question at a time?

Unread post by jaelharrup » 5 Mar 2012 11:17

Hi,

i am asking if it is possible to have a list of questions in a listbox, but only display one question at a time while hiding the other questions pending an answer which is in a radio button, then on clicking the radio button (either Yes or No) the next question is displayed and the initial one hidden but maintain the Yes and No radio button for all the set of questions?

please i need urgent help.

Jael

Paul Cerkez
VIP Member
Posts: 202
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 5 Mar 2012 13:00

From your posts, I assume you are building a simple diagnostics tree (each question's response leads to the next question until you hit a terminal node)

My 'simple" suggestion would be for you to create a simple dialog box/form with 3 form objects:

a Text box sized to hold the biggest question you ask
2 radios (or buttons) to capture the yes or no response. (keep the standard Ok and Cancel buttons)

once this form is built, the rest of the effort is in your code behind the scenes.

in the background code you mantain an "internal" database (either in code or in a saved file) of all your questions and unless you are supporting the user being able to 'back up' and change answers, you don't need to store their response.

the internal database would be structured to hold a unique identifier for each question, the current question's text and have 2 more fields to hold the Id of the next question based on a yes or no response

questions(ID, Question, YesID, NoID).

when the user, opens the form, you populate the Text box with your first question.

As the user answers each question, you jump to the next apporiate question and populate the Text box with the new question.

when you hit the terminal node, you simply display the result in the text box and the yes/no response IDs are set to 0 (or back to your 1st question).

this makes the application more data driven. Once you build the code, the diagnostics tree can be maintained/updated in a text file that you consult at the beginning of each session. (save/consult predicates) (example - if you wantot change the application from health to cars, you simple change the text file constaing the questions)

again, this suggestion is for a simple diagnostics tree. As you develop more skills in this area (and in VIP), there are more complex, flexible, robust, and 'elegent' ways to do diagnostic questionaires.

P.
AI Rules!
P.

jaelharrup
Active Member
Posts: 27
Joined: 18 Feb 2011 11:59

Unread post by jaelharrup » 5 Mar 2012 13:42

Paul Thank you so much,

i need guidance and help on how to work the codes behind the scene.

1.how do i maintain an "internal" database (either in code or in a saved file) of all your questions?

2.How do i design and structure the internal database to hold a unique identifier for each question, the current question's text and have 2 more fields to hold the Id of the next question based on a yes or no response

questions(ID, Question, YesID, NoID).

3. How do i populate the Text box with the first question when the user, opens the form.

4. how do i make this part (As the user answers each question, you jump to the next appropriate question and populate the Text box with the new question).

5. How do i achieve this part (when you hit the terminal node, you simply display the result in the text box and the yes/no response IDs are set to 0 (or back to your 1st question).

Please help

i really want to learn.

Jael

Harrison Pratt
VIP Member
Posts: 295
Joined: 5 Nov 2000 0:01

Unread post by Harrison Pratt » 5 Mar 2012 14:31

The best thing is to install the Visual Prolog Examples and work through the ones relevant to your project. These are tiny projects for you to study to see how the various controls should be managed. There are demos for handling lists, buttons, etc.

Be prepared to spend some quiet time working through these so you understand. The [Help] button is your friend ... use it often!

Paul Cerkez
VIP Member
Posts: 202
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 5 Mar 2012 14:41

to follow up with what Harrison said:

Have you completed Visual Prolog for Tyros:
http://wiki.visual-prolog.com/index.php ... _for_Tyros


Have you completed the VIP fundamentals tutorials:
http://wiki.visual-prolog.com/index.php ... g_Tutorial

there is a lot of basic information in these that can help guide you on how to approach and solve this.

like Harrison said, be prepared to spend a little time so that you understand it. The time spent up front will pay bigger dividends later when you actually start work on your application.
AI Rules!
P.

Post Reply