Example #1
0
func Createsebaris(Theme gxui.Theme, S data.Setoran) UISetoran {
	var TB UISetoran
	TB.TBJumlah = Theme.CreateTextBox()
	TB.TBCatatan = Theme.CreateTextBox()
	TB.TBJumlah.SetText(strconv.Itoa(S.Jumlah))
	TB.TBCatatan.SetText(S.Catatan)
	return TB
}
Example #2
0
func Createwinsewa(Theme gxui.Theme, arrdata []data.Anakkost) Winsewa {
	var hasil Winsewa
	Layoutbase := Theme.CreateLinearLayout()
	layoutbutton := Theme.CreateLinearLayout()
	layoutbutton.SetDirection(gxui.LeftToRight)
	layoutjumlah := Theme.CreateLinearLayout()
	layoutjumlah.SetDirection(gxui.LeftToRight)

	hasil.Window = Theme.CreateWindow(500, 500, "SEWA")
	hasil.Daftaruianakkost = Semuabaris(Theme, arrdata)

	hasil.buttonsave = Theme.CreateButton()
	hasil.buttonsave.SetText("SAVE")
	btnjumlah := Theme.CreateButton()
	btnjumlah.SetText("JUMLAHKAN")

	labeljumlah := Theme.CreateLabel()
	labeljumlah.SetText("Jumlah:")
	labelnama := Theme.CreateLabel()
	labelnama.SetText("NAMA")
	labelsewa := Theme.CreateLabel()
	labelsewa.SetText("SEWA")
	labelcatatan := Theme.CreateLabel()
	labelcatatan.SetText("CATATAN")

	btnjumlah.OnClick(jumlahonclick)

	tbjumlah = Theme.CreateTextBox()

	var buttonsaveclick = func(e gxui.MouseEvent) {
		Save(hasil)
	}
	hasil.buttonsave.OnClick(buttonsaveclick)

	layoutjumlah.AddChild(btnjumlah)
	layoutjumlah.AddChild(labeljumlah)
	layoutjumlah.AddChild(tbjumlah)
	layoutbutton.AddChild(hasil.buttonsave)
	Layoutbase.AddChild(layoutbutton)
	Layoutbase.AddChild(layoutjumlah)

	LayoutTB := Theme.CreateTableLayout()
	numberrow := len(hasil.Daftaruianakkost) + 1
	LayoutTB.SetGrid(3, numberrow)

	LayoutTB.SetChildAt(0, 0, 1, 1, labelnama)
	LayoutTB.SetChildAt(1, 0, 1, 1, labelsewa)
	LayoutTB.SetChildAt(2, 0, 1, 1, labelcatatan)
	Layoutbase.AddChild(LayoutTB)

	for i := 0; i < len(hasil.Daftaruianakkost); i++ {
		LayoutTB.SetChildAt(0, i+1, 1, 1, hasil.Daftaruianakkost[i].TBNama)
		LayoutTB.SetChildAt(1, i+1, 1, 1, hasil.Daftaruianakkost[i].TBSewa)
		LayoutTB.SetChildAt(2, i+1, 1, 1, hasil.Daftaruianakkost[i].TBCatatan)
	}
	hasil.Window.AddChild(Layoutbase)
	return hasil
}
Example #3
0
func Createsebaris(Theme gxui.Theme, Data data.Anakkost) UISewa {
	var TB UISewa
	TB.TBNama = Theme.CreateTextBox()
	TB.TBSewa = Theme.CreateTextBox()
	TB.TBCatatan = Theme.CreateTextBox()
	TB.TBNama.SetText(Data.Nama)
	TB.TBSewa.SetText(strconv.Itoa(Data.Sewa))
	TB.TBCatatan.SetText(Data.Catatan)
	return TB
}
Example #4
0
func Createwinsetoran(Theme gxui.Theme, arrdata []data.Setoran) Winsetoran {
	var hasil Winsetoran
	hasil.Window = Theme.CreateWindow(500, 500, "SETORAN")
	layoutbase := Theme.CreateLinearLayout()
	layoutbutton := Theme.CreateLinearLayout()
	layoutbutton.SetDirection(gxui.LeftToRight)
	layoutjumlah := Theme.CreateLinearLayout()
	layoutjumlah.SetDirection(gxui.LeftToRight)

	hasil.buttonsave = Theme.CreateButton()
	hasil.buttonsave.SetText("SAVE")
	var buttonsaveclick = func(e gxui.MouseEvent) {
		Save(hasil)
	}
	hasil.buttonsave.OnClick(buttonsaveclick)

	hasil.Daftarsetoran = Semuabaris(Theme, arrdata)
	layoutbutton.AddChild(hasil.buttonsave)
	layoutbase.AddChild(layoutbutton)

	layouttabel := Theme.CreateTableLayout()
	row := len(hasil.Daftarsetoran)
	layouttabel.SetGrid(2, row+1)

	tbjumlah = Theme.CreateTextBox()
	buttonjumlah := Theme.CreateButton()
	buttonjumlah.SetText("JUMLAHKAN")
	buttonjumlah.OnClick(jumlahonclick)

	labelcatatan := Theme.CreateLabel()
	labelcatatan.SetText("CATATAN")
	labeljumlah := Theme.CreateLabel()
	labeljumlah.SetText("JUMLAH")
	labelhasiljumlah := Theme.CreateLabel()
	labelhasiljumlah.SetText("JUMLAH:")

	layoutjumlah.AddChild(buttonjumlah)
	layoutjumlah.AddChild(labelhasiljumlah)
	layoutjumlah.AddChild(tbjumlah)
	layouttabel.SetChildAt(0, 0, 1, 1, labelcatatan)
	layouttabel.SetChildAt(1, 0, 1, 1, labeljumlah)
	for i := 0; i < len(hasil.Daftarsetoran); i++ {
		layouttabel.SetChildAt(0, i+1, 1, 1, hasil.Daftarsetoran[i].TBCatatan)
		layouttabel.SetChildAt(1, i+1, 1, 1, hasil.Daftarsetoran[i].TBJumlah)
	}
	layoutbase.AddChild(layoutjumlah)
	layoutbase.AddChild(layouttabel)
	hasil.Window.AddChild(layoutbase)
	return hasil
}
Example #5
0
func makeDataField(theme gxui.Theme, label string) *dataField {
	df := new(dataField)
	df.label = theme.CreateLabel()
	df.label.SetText(label)
	df.input = theme.CreateTextBox()
	df.err = theme.CreateLabel()
	df.err.SetColor(gxui.Red)
	df.layout = theme.CreateLinearLayout()
	df.layout.SetDirection(gxui.LeftToRight)
	df.layout.AddChild(df.label)
	df.layout.AddChild(df.input)
	df.layout.AddChild(df.err)

	return df
}
Example #6
0
func overview(theme gxui.Theme) gxui.Control {
	layout := theme.CreateLinearLayout()
	layout.SetPadding(math.ZeroSpacing)
	layout.SetMargin(math.ZeroSpacing)
	layout.SetSize(math.Size{W: 400, H: 400})

	font := theme.DefaultFont()

	label := theme.CreateLabel()
	label.SetFont(font)
	label.SetText("Overview")
	layout.AddChild(label)

	textBox := theme.CreateTextBox()
	textBox.SetFont(font)
	textBox.SetText("")
	textBox.SetDesiredWidth(800)

	button := theme.CreateButton()
	button.SetHorizontalAlignment(gxui.AlignCenter)
	button.SetText("Test")
	button.OnClick(func(gxui.MouseEvent) { test() })
	layout.AddChild(button)

	button2 := theme.CreateButton()
	button2.SetHorizontalAlignment(gxui.AlignCenter)
	button2.SetText("GetAddresses")
	button2.OnClick(func(gxui.MouseEvent) {
		balances := getAddressesString()
		textBox.SetText(balances)
	})
	layout.AddChild(button2)

	button3 := theme.CreateButton()
	button3.SetHorizontalAlignment(gxui.AlignCenter)
	button3.SetText("GetBalances")
	button3.OnClick(func(gxui.MouseEvent) {
		balances := getBalancesString()
		textBox.SetText(balances)
	})
	layout.AddChild(button3)

	layout.AddChild(textBox)

	return layout
}
Example #7
0
// Create implements gxui.TreeNode.
func (n *node) Create(theme gxui.Theme) gxui.Control {
	layout := theme.CreateLinearLayout()
	layout.SetDirection(gxui.LeftToRight)

	label := theme.CreateLabel()
	label.SetText(n.name)

	textbox := theme.CreateTextBox()
	textbox.SetText(n.name)
	textbox.SetPadding(math.ZeroSpacing)
	textbox.SetMargin(math.ZeroSpacing)

	addButton := theme.CreateButton()
	addButton.SetText("+")
	addButton.OnClick(func(gxui.MouseEvent) { n.add("<new>") })

	edit := func() {
		layout.RemoveAll()
		layout.AddChild(textbox)
		layout.AddChild(addButton)
		gxui.SetFocus(textbox)
	}

	commit := func() {
		n.name = textbox.Text()
		label.SetText(n.name)
		layout.RemoveAll()
		layout.AddChild(label)
		layout.AddChild(addButton)
	}

	// When the user clicks the label, replace it with an editable text-box
	label.OnClick(func(gxui.MouseEvent) { edit() })

	// When the text-box loses focus, replace it with a label again.
	textbox.OnLostFocus(commit)

	layout.AddChild(label)
	layout.AddChild(addButton)
	return layout
}
Example #8
0
func Createwindashboard(theme gxui.Theme) gxui.Window {
	window := theme.CreateWindow(500, 500, "Dashboard")
	layoutdashboard := theme.CreateLinearLayout()
	layoutbutton := theme.CreateLinearLayout()
	layoutbutton.SetDirection(gxui.LeftToRight)
	layoutbutton.SetHorizontalAlignment(gxui.AlignLeft)
	layouttahun := theme.CreateLinearLayout()
	layouttahun.SetDirection(gxui.LeftToRight)
	layouttahun.SetHorizontalAlignment(gxui.AlignLeft)
	layoutbulan := theme.CreateLinearLayout()
	layoutbulan.SetDirection(gxui.LeftToRight)
	layoutbulan.SetHorizontalAlignment(gxui.AlignLeft)
	layoutsavenload := theme.CreateLinearLayout()
	layoutsavenload.SetDirection(gxui.LeftToRight)
	layoutsavenload.SetHorizontalAlignment(gxui.AlignLeft)
	layoutdir := theme.CreateLinearLayout()
	layoutdir.SetDirection(gxui.LeftToRight)
	layoutdir.SetHorizontalAlignment(gxui.AlignLeft)

	btneditsewa := theme.CreateButton()
	btneditsewa.SetText("Edit Sewa")
	btneditsewa.OnClick(Btneditsewabulananonclick)
	btneditpengeluaran := theme.CreateButton()
	btneditpengeluaran.SetText("Edit Pengeluaran")
	btneditpengeluaran.OnClick(Btneditpengeluaranonclick)
	btneditsetoran := theme.CreateButton()
	btneditsetoran.SetText("Edit Setoran")
	btneditsetoran.OnClick(Btneditsetoranonclick)
	btnsave := theme.CreateButton()
	btnsave.SetText("SAVE")
	btnload := theme.CreateButton()
	btnload.SetText("LOAD")

	btnsave.OnClick(Btnsaveonclick)
	btnload.OnClick(Btnloadonclick)

	tbtahun = theme.CreateTextBox()
	tbbulan = theme.CreateTextBox()
	tbdirectory = theme.CreateTextBox()

	labeltahun := theme.CreateLabel()
	labeltahun.SetText("TAHUN")
	labelbulan := theme.CreateLabel()
	labelbulan.SetText("BULAN")
	labeldirectory := theme.CreateLabel()
	labeldirectory.SetText("DIRECTORY")

	layoutbutton.AddChild(btneditsewa)
	layoutbutton.AddChild(btneditpengeluaran)
	layoutbutton.AddChild(btneditsetoran)
	layouttahun.AddChild(labeltahun)
	layouttahun.AddChild(tbtahun)
	layoutbulan.AddChild(labelbulan)
	layoutbulan.AddChild(tbbulan)
	layoutsavenload.AddChild(btnsave)
	layoutsavenload.AddChild(btnload)
	layoutdir.AddChild(labeldirectory)
	layoutdir.AddChild(tbdirectory)

	layoutdashboard.AddChild(layoutbutton)
	layoutdashboard.AddChild(layoutdir)
	layoutdashboard.AddChild(layouttahun)
	layoutdashboard.AddChild(layoutbulan)
	layoutdashboard.AddChild(layoutsavenload)

	window.AddChild(layoutdashboard)

	return window
}
Example #9
0
func createIpText(theme gxui.Theme) gxui.TextBox {
	textBox := theme.CreateTextBox()
	textBox.SetText("192.168.1.234")
	return textBox

}