EuGTK:Working Demo For Pop-up Dialog to Collect A String
- Posted by euphoric (admin) Sep 23, 2019
- 893 views
Irv, is there a working demo of popping up a dialog to capture string input from the user? I don't know whether to build my own dialog for that or customize a built-in one.
I'm having a user click a "Create New Project" button on an opening dialog, and I want to pop up a modal dialog box to capture the name of the project first. How do you recommend doing that?
Here's the dialog I'm trying to use: can I get the value in txt_newProjectName returned to me? Should I just use "add" to customize a built-in dialog box?
If I use my dialog, do I need to write a function to capture the string when the user clicks "Create," or will it act as a function and return that value to me?
constant winNewProject = create(GtkWindow,"title=`New Project`,size=400x200,border_width=8,position=1"), panel_NewProject = create(GtkBox,VERTICAL), panel_NewProjectName = create(GtkBox,HORIZONTAL), panel_NewProjectButtons = create(GtkBox,HORIZONTAL), lbl_newProjectName = create(GtkLabel,"New Project Name"), txt_newProjectName = create(GtkEntry,{ {"margin top",10}, {"margin_bottom",10}, {"placeholder text","Name your new project"} }), bttn_NewProjectCreate = create(GtkButton,"Create"), bttn_NewProjectCancel = create(GtkButton,"Cancel") pack(panel_NewProjectName, {lbl_newProjectName, txt_newProjectName}) pack(panel_NewProjectButtons, {bttn_NewProjectCreate,bttn_NewProjectCancel}) pack(panel_NewProject,{panel_NewProjectName,panel_NewProjectButtons}) add(winNewProject,panel_NewProject)