User Tools

Site Tools


k12:k12.4:k12.4.4:start

12.4.4 Custom Dialogues

A dialog allows the selection, entry or modification of data required by a (main) program at program start-up or run-time. The terms dialogue, dialogue box and dialogue window are used synonymously. A dialogue is realised as part of the graphical user interface - as you have become acquainted with in Chapters 12.4.0 to 12.4.2 with the standard dialogues. A dialogue is almost always called modally from the (main) program. This has the effect that the (main) program pauses while selections are made or data is edited interactively in the dialogue window. Alternatively, the edited data is then accepted or the dialogue is cancelled - in both cases the dialogue window is closed. The examples and projects presented in the above chapters have shown that using the standard dialogues in Gambas is simple and convenient.

For special tasks outside the field of application of standard dialogues, Gambas offers tried and tested concepts for developing your own dialogues. It is precisely these concepts and their implementation that this chapter is dedicated to.

For a simple Internet radio client (GUI for the console program mplayer), for example, there was a requirement to maintain a list of stations (URL and station name) at program runtime. A dialogue → Figure 12.4.4.1 should be developed with which new stations can be added to the list or existing stations can be changed or deleted individually. In addition, it should be possible to move individual stations in the list or to delete the station list completely. On the one hand, the changed station list should be taken over as a new station list or, on the other hand, the dialogue should be cancelled at any time and changes already made to the station list discarded.

B1
Figure 12.4.4.1: Dialogue window

In the figure → '12.4.4.1 Dialogue box' you can see that the data in the transmitter list can be edited in a variety of ways and that the two buttons typical of a dialogue box are present for cancelling the dialogue and accepting the edited data.

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k12/k12.4/k12.4.4/start.txt · Last modified: 01.02.2022 (external edit)

Page Tools