Flatten create structure
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
283
advotracker_client/examples/size_test.rs
Normal file
283
advotracker_client/examples/size_test.rs
Normal file
@@ -0,0 +1,283 @@
|
||||
use orbtk::prelude::*;
|
||||
|
||||
fn main() {
|
||||
// use this only if you want to run it as web application.
|
||||
orbtk::initialize();
|
||||
|
||||
Application::new()
|
||||
.window(|ctx| {
|
||||
Window::new()
|
||||
.title("OrbTk - Test Size/Bounds")
|
||||
.position((100.0, 100.0))
|
||||
//.size(200.0, 150.0)
|
||||
.size(800.0, 600.0)
|
||||
//.min_size(160.0, 120.0)
|
||||
//.max_size(240.0, 180.0)
|
||||
.always_on_top(true)
|
||||
.resizeable(true)
|
||||
.child(MainView::new().build(ctx))
|
||||
.build(ctx)
|
||||
})
|
||||
.run();
|
||||
}
|
||||
|
||||
widget!(
|
||||
MainView {
|
||||
policy_number: String16
|
||||
}
|
||||
);
|
||||
|
||||
impl Template for MainView {
|
||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||
let ticket_data_header_bar = Container::new()
|
||||
//.id(ID_TICKET_DATA_HEADER_CONTAINER)
|
||||
//.style(STYLE_HEADER_BAR)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(1))
|
||||
.attach(Grid::column_span(2))
|
||||
.child(
|
||||
Grid::new()
|
||||
.child(
|
||||
TextBlock::new()
|
||||
//.id(ID_TICKET_DATA_HEADER_GRID)
|
||||
.style("header")
|
||||
.v_align("center")
|
||||
.h_align("left")
|
||||
.text("Ticket Data")
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
//.child(ticket_data_button_menu)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_form_row_0 = Stack::new()
|
||||
.name("Row 0")
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_form = Container::new()
|
||||
//.id(ID_TICKET_DATA_FORM)
|
||||
.name("TicketdataContainer")
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(1))
|
||||
//.margin(16)
|
||||
.padding(14)
|
||||
.border_brush("#dfebf5")
|
||||
.border_radius(0)
|
||||
.border_width(1)
|
||||
.child(
|
||||
Grid::new()
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push("auto") // Label
|
||||
.push(14) // Delimiter
|
||||
.push("*") // Data
|
||||
.push(4) // Delimiter
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("auto") // Row 0
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 2
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 4
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 6
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 8
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 10
|
||||
.push(14) // Seperator
|
||||
.push("auto") // Row 12
|
||||
)
|
||||
|
||||
//.child(ticket_data_form_row_0)
|
||||
//.child(ticket_data_form_row_1)
|
||||
//.child(ticket_data_form_row_2)
|
||||
//.build(ctx),
|
||||
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel1")
|
||||
.text("Policy number")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
//.foreground("#516475")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox1")
|
||||
.text("9999999990")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel2")
|
||||
.text("Policy holder")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox2")
|
||||
.text("Name des Versicherungsnehmers")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(4))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel3")
|
||||
.text("Deductible")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.attach(Grid::row(4))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox3")
|
||||
.text("im Beratungsgespräch erfragen")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(6))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel4")
|
||||
.text("Callback number")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.attach(Grid::row(6))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox4")
|
||||
.water_mark("wie zu erreichen")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(8))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel5")
|
||||
.text("Callback date")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.attach(Grid::row(8))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox5")
|
||||
.water_mark("Rückruf gewünscht um")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(10))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel6")
|
||||
.water_mark("Harm type")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.attach(Grid::row(10))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox6")
|
||||
.water_mark("Rechtsproblem/Schadenstyp")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.attach(Grid::row(12))
|
||||
.attach(Grid::column(0))
|
||||
.name("TextLabel7")
|
||||
.text("IVR comment")
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBox::new()
|
||||
.attach(Grid::row(12))
|
||||
.attach(Grid::column(2))
|
||||
.name("TextBox7")
|
||||
.water_mark("Rechtsrat / Kommentar zu Haftungs, bzw. Deckung")
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
let ticket_data_action = Stack::new()
|
||||
//.id(ID_TICKET_DATA_STACK)
|
||||
.attach(Grid::row(3))
|
||||
.attach(Grid::column(1))
|
||||
.h_align("end")
|
||||
.v_align("top")
|
||||
.orientation("horizontal")
|
||||
.visibility(Visibility::Collapsed)
|
||||
//.spacing("4")
|
||||
|
||||
.child(
|
||||
Button::new()
|
||||
.margin(14)
|
||||
.name("TicketdataContainer")
|
||||
.text("Senden")
|
||||
.icon(material_icons_font::MD_MAIL)
|
||||
.on_click(move |_ctx, _| {
|
||||
println!("WIP: send mail");
|
||||
// ctx.get_mut::<MenuState>(id)
|
||||
// .set_action(MenuAction::CreateMenu(ID_MENU_STACK));
|
||||
true
|
||||
})
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
// Starter page: Ticket Data Widget
|
||||
self.name("TicketdataView")
|
||||
.child(
|
||||
Grid::new()
|
||||
//.id(ID_TICKET_DATA_WIDGET)
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(50)
|
||||
.push("*")
|
||||
.push(50)
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("auto") // Header
|
||||
.push(28) // Seperator
|
||||
.push("*") // InputForm
|
||||
.push("auto") // ActionSend
|
||||
//.push("auto") // Bottom )
|
||||
)
|
||||
|
||||
.child(ticket_data_header_bar) // row 0
|
||||
.child(ticket_data_form) // row 2
|
||||
.child(ticket_data_action) // row 3
|
||||
.build(ctx),
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user