^ image is the filename of an image
^ Position and size units are inventory slots
+button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]
+^ When clicked, fields will be sent and the form will quit.
+
+image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]
+^ When clicked, fields will be sent and the form will quit.
+
Inventory location:
- "context": Selected node metadata (deprecated: "current_name")
- "current_player": Player to whom the menu is shown
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"button[0.5,7;2,1;button1;Button 1]"..
- "button[2.5,7;2,1;button2;Button 2]"
+ "button_exit[2.5,7;2,1;button2;Exit Button]"
)
minetest.chat_send_player(name, "Done.");
end,
delete m_selected_item;
delete m_form_src;
+ delete m_text_dst;
}
void GUIFormSpecMenu::removeChildren()
Environment->addStaticText(spec.flabel.c_str(), rect, false, true, this, spec.fid);
m_fields.push_back(spec);
}
- else if(type == "button")
+ else if(type == "button" || type == "button_exit")
{
v2s32 pos;
pos.X = stof(f.next(",")) * (float)spacing.X;
258+m_fields.size()
);
spec.is_button = true;
+ if(type == "button_exit")
+ spec.is_exit = true;
Environment->addButton(rect, this, spec.fid, spec.flabel.c_str());
m_fields.push_back(spec);
}
- else if(type == "image_button")
+ else if(type == "image_button" || type == "image_button_exit")
{
v2s32 pos;
pos.X = stof(f.next(",")) * (float)spacing.X;
258+m_fields.size()
);
spec.is_button = true;
+ if(type == "image_button_exit")
+ spec.is_exit = true;
video::ITexture *texture = m_gamedef->tsrc()->getTextureRaw(fimage);
gui::IGUIButton *e = Environment->addButton(rect, this, spec.fid, spec.flabel.c_str());
}
}
m_text_dst->gotText(fields);
- delete m_text_dst;
- m_text_dst = NULL;
}
}
{
s.send = true;
acceptInput();
- quitMenu();
- return true;
+ if(s.is_exit){
+ quitMenu();
+ return true;
+ }else{
+ s.send = false;
+ return true;
+ }
}
}
}