VgaGames4

VgaGames4 - dialog man-pages

[.. upper level ..]

# vg4->dialog->nw_clientname()

Open a canvas-dialog for typing in client-name for network.

SYNTAX
VG_BOOL vg4->dialog->nw_clientname(char *clname, size_t clsize, const char *cvasdir, const struct VG_Position *posdst, struct VG_Hash *hvar)
FUNCTION PARAMETERS

clname | For passing default client-name and returning client-name
clsize | Size of clname
cvasdir | Directory to load canvasses from, or NULL = use system-canvasses
posdst | Canvas-position on window, or NULL = centered
hvar | Hash with variable-values (see vg4->canvas->load())

RETURN VALUE
Returns boolean: - VG_TRUE: OK - VG_FALSE: Got exit-request
DESCRIPTION
Open a canvas-dialog for typing in client-name for network. This function uses following canvas-file (installed below share/vgagames4/canvas/) - nw.clientname.cvas: Top-canvas The parameter hvar should contain following variables - key: clientname:title value: title of top-canvas If the returned clname is empty, the function was cancelled. If own canvas-files shall be used instead of the system-canvas-files, they must lay in cvasdir or cvasdir/network/ and have the same names as the system-canvas-files: - nw.clientname.cvas - uses canvas-items: - [CV-TEXT] with name title: text for title - [CV-INPUT] with name input: for typing in client-name - uses variables: - key: title value: title of canvas
EXAMPLE

      struct VG_Hash *hvar;
      char clname[256];

      hvar = vg4->hash->create();

      /* set variables */
      vg4->hash->setstr(hvar, "clientname:title", "Name of the client");

      /* execute dialog */
      *clname = '\0';  /* no default client-name */
      if (!vg4->dialog->nw_clientname(clname, sizeof(clname), NULL, NULL, hvar)) {
        /* exit request */
        VG_dest();
        exit(0);
      }

      vg4->hash->destroy(hvar);

      if (*clname != '\0') {  /* not cancelled */
        printf("Client-name: %s\n", clname);
      }