Skip to main content
Dmitriy K.
Known Participant
September 15, 2021
Question

Recreate a dialog box from a picture

  • September 15, 2021
  • 2 replies
  • 191 views

Is there an easy way to recreate a dialog box that looks exactly like in the picture. With buttons in those cells highlighted in red.

I tried the example from the API, it works, but the structure of the nested elements for my picture will be very complex.

var dialog1 = {
initialize: function (dialog) {
var todayDate = dialog.store()["date"];
todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
dialog.load({ "date": todayDate });
},
commit:function (dialog) {
var results = dialog.store();
console.println("Your name is " + results["fnam"]
+ " " + results["lnam"] );
},
description:
{
name: "Personal Data",
align_children: "align_left",
width: 350,
height: 200,
elements:
[
{
type: "cluster",
name: "Your Name",
align_children: "align_left",
elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "First Name: "
},
{
item_id: "fnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Last Name: "
},
{
item_id: "lnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "static_text",
name: "Date: ",
char_width: 25,
item_id: "date"
},
]
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
}
]
}
};
app.execDialog(dialog1);

 

This topic has been closed for replies.

2 replies

BarlaeDC
Community Expert
Community Expert
September 15, 2021

HI,

 

It is a complex dialog that you want to create and I think through JavaScript it will be very complicated, would you consider doing what you need through a plug-in as that offers better (IMO) control of how you create dialogs, If you are limited to JavaScript then it will be complicated.

 

There is a sample in the SDK called wxPlugin, which gives an idea of how it works ( note: it has not been updated in a while) there may be a better solution.

try67
Community Expert
Community Expert
September 15, 2021

A dialog is not suitable for this kind of complex layout.