I am currently writing a program where it gets to a point where it has to ask a question. I have created a group box which pops up, asking the question and giving a yes/no choice. the onclick event of the "yes" button sets a bool to true and the onclick of button "no" event sets the bool to false. The bool is set to false be default

The problem I have is that the program skips straight past the option of the bool being true as it doesnt give the user a chance to click a button. Is there a way that I can tell delphi to wait till either the yes or no button is pressed. Even a function that is already built into delphi 2005 would do the job, but it would need to have only yes/no buttons to respond.

Any ideas?


Sean Bedford

seems like u are using one big procedure that include most of the program, right? that wolud be the troble. ur code must stop when u have to choose beetween yes and no. in yes.OnClick u write ur code for yes and in no.OnClick u write the code for no.... not just bool=true/false. programing in delphi is differet from pascal...
i hope i understood right ur problem and i gaved a right answer...

yeah, it is all part of 1 big procedure. What I am doing is like a supermarket till system. This question is for age checking, like alcohol etc, the question asks if the customer is old enough. The question is only brought up if the age restriction on the item is > than the currently logged customer age (gotten from asking the question before). This means that the question must come up in the procedure of adding the item to the bill, as each item could have a different age restriction on it. So I dont think its possible to seperate it out into the yes/no button code

than u need a nother button in the end of the list of the questions. so the user will press that button after answering all the questions. u contionue the code in that button. u will not a boolean variable for each question...or an integer variable that could be -1 initial and 0/1 after user will answer the question(so u can check if the user answered that question or skip it)

Ok I got it going now - theres a function called messagedlg, which can be used to ask a question and display a yes/no option

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.