Preparing to use a dialogue.

Using dialogue boxes is, unfortunately, the most complicated part of writing a module. It's annoying in the beginning, but, after your first dialogue is done, you'll be able to scavenge code and re-use it at will. I've been doing the same!

So, let's dive straight into it with some code to prepare and issue a dialogue box. We'll be issuing a dialogue with the following controls:

  1. An 80 character string field.

  2. A 30 character password field.

  3. A list selection field allowing `Yes', `No' and `Maybe' (5 characters maximum).

  4. A toggle control (3 characters, because these controls report `on' or `off' depending on their state.

  5. A button labeled `OK'.

  6. Another button, `Cancel'.

Here's the code:

    int  result;

    sprintf (inp_buffer,"%s\n%s\ns\n%s\nOK\nCancel\n",
                        "First string field",
			"password",
			"Yes",
			"on");

    result = dialog_run ("foo", FOOVT, FOOLT, inp_buffer, MAXINPLEN);

    if (result!=0) {
            error_log("Unable to run data entry subsystem");
	    return;
    }

    

This code demonstrates quite a few things:

Alphabetic index



This page was generated with the help of DOC++.