package main import ( "github.com/ying32/govcl/vcl" "github.com/ying32/govcl/vcl/types" ) type TRedisConnectionDialog struct { *vcl.TForm Address *vcl.TEdit Port *vcl.TSpinEdit Password *vcl.TEdit IsResp3Protocol *vcl.TCheckBox } func (f *TRedisConnectionDialog) OnFormCreate(sender vcl.IObject) { f.SetCaption("Connect to Redis...") f.ScreenCenter() // row 1 row1 := vcl.NewPanel(f) row1.SetParent(f) row1.SetBorderStyle(types.BsNone) row1.SetAlign(types.AlTop) row1.SetTop(1) row1.SetAutoSize(true) lblAddress := vcl.NewStaticText(row1) lblAddress.SetParent(row1) lblAddress.SetCaption("Address:") lblAddress.SetAlign(types.AlLeft) lblAddress.SetLeft(1) //lblAddress.SetAutoSize(true) f.Address = vcl.NewEdit(row1) f.Address.SetParent(row1) f.Address.SetAlign(types.AlLeft) f.Address.SetWidth(MY_WIDTH) f.Address.SetLeft(2) lblPort := vcl.NewStaticText(row1) lblPort.SetParent(row1) lblPort.SetCaption(":") lblPort.SetAlign(types.AlLeft) lblPort.SetLeft(3) lblPort.SetAutoSize(true) f.Port = vcl.NewSpinEdit(row1) f.Port.SetParent(row1) f.Port.SetMinValue(1) f.Port.SetMaxValue(65535) f.Port.SetValue(6379) // Redis default port f.Port.SetAlign(types.AlLeft) f.Port.SetLeft(4) // row 2 row2 := vcl.NewPanel(f) row2.SetParent(f) row2.SetBorderStyle(types.BsNone) row2.SetAlign(types.AlTop) row2.SetTop(2) row2.SetAutoSize(true) lblPassword := vcl.NewStaticText(row2) lblPassword.SetParent(row2) lblPassword.SetCaption("Password:") lblPassword.SetAlign(types.AlLeft) lblPassword.SetLeft(1) // lblPassword.SetAutoSize(true) f.Password = vcl.NewEdit(row2) f.Password.SetParent(row2) f.Password.SetAlign(types.AlLeft) f.Password.SetLeft(2) f.Password.SetWidth(MY_WIDTH) f.Password.SetPasswordChar(uint16('*')) // row 3 f.IsResp3Protocol = vcl.NewCheckBox(f) f.IsResp3Protocol.SetParent(f) f.IsResp3Protocol.SetCaption("Use RESP v3 protocol") f.IsResp3Protocol.SetChecked(true) f.IsResp3Protocol.SetAlign(types.AlTop) f.IsResp3Protocol.SetTop(3) }