• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang walk.NewPushButton函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/lxn/walk.NewPushButton函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPushButton函数的具体用法?Golang NewPushButton怎么用?Golang NewPushButton使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewPushButton函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: init

func (mw *MyWindow) init() (err error) {
	mw.SetMinimizeBox(true)
	mw.SetMaximizeBox(false)
	mw.SetFixedSize(true)

	mw.MainWindow, _ = walk.NewMainWindow()
	succeeded := false
	defer func() {
		if !succeeded {
			mw.Dispose()
		}
	}()

	mw.SetClientSize(walk.Size{260, 160})

	mw.SetTitle("主窗体")

	mw.ui.SecTitileLb, _ = walk.NewLabel(mw)
	mw.ui.SecTitileLb.SetText("子窗体:")
	mw.ui.SecTitileLb.SetBounds(walk.Rectangle{10, 50, 50, 20})

	mw.ui.SecTitileLe, _ = walk.NewLineEdit(mw)
	mw.ui.SecTitileLe.SetBounds(walk.Rectangle{60, 50, 160, 20})
	mw.ui.SecTitileLe.SetWidth(150)

	mw.ui.CreateBtn, _ = walk.NewPushButton(mw)
	mw.ui.CreateBtn.SetText("生成子窗体")
	mw.ui.CreateBtn.SetBounds(walk.Rectangle{90, 100, 75, 25})

	succeeded = true

	return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:33,代码来源:master_ui.go


示例2: Create

func (pb PushButton) Create(builder *Builder) error {
	w, err := walk.NewPushButton(builder.Parent())
	if err != nil {
		return err
	}

	return builder.InitWidget(pb, w, func() error {
		if err := w.SetImage(pb.Image); err != nil {
			return err
		}

		if err := w.SetImageAboveText(pb.ImageAboveText); err != nil {
			return err
		}

		if pb.OnClicked != nil {
			w.Clicked().Attach(pb.OnClicked)
		}

		if pb.AssignTo != nil {
			*pb.AssignTo = w
		}

		return nil
	})
}
开发者ID:2105666566,项目名称:walk,代码行数:26,代码来源:pushbutton.go


示例3: Create

func (pb PushButton) Create(builder *Builder) error {
	w, err := walk.NewPushButton(builder.Parent())
	if err != nil {
		return err
	}

	return builder.InitWidget(pb, w, func() error {
		img := pb.Image
		if s, ok := img.(string); ok {
			var err error
			if img, err = walk.NewImageFromFile(s); err != nil {
				return err
			}
		}
		if img != nil {
			if err := w.SetImage(img.(walk.Image)); err != nil {
				return err
			}
		}

		if err := w.SetImageAboveText(pb.ImageAboveText); err != nil {
			return err
		}

		if pb.OnClicked != nil {
			w.Clicked().Attach(pb.OnClicked)
		}

		if pb.AssignTo != nil {
			*pb.AssignTo = w
		}

		return nil
	})
}
开发者ID:Archs,项目名称:walk,代码行数:35,代码来源:pushbutton.go


示例4: main

func main() {
	walk.Initialize(walk.InitParams{PanicOnError: true})
	defer walk.Shutdown()

	mainWnd, err := walk.NewMainWindow()
	if err != nil {
		return
	}

	mw := &MainWindow{MainWindow: mainWnd}

	mw.SetTitle("SocketIm Example")

	button1, _ := walk.NewPushButton(mw)
	button1.SetText("start port 8000")
	button1.SetX(10)
	button1.SetY(10)
	button1.SetWidth(100)
	button1.SetHeight(30)

	button1.Clicked().Attach(func() {
		go NewTalkWindow(mw, 8000, 8001)
		button1.SetEnabled(false)
	})

	button2, _ := walk.NewPushButton(mw)
	button2.SetText("start port 8001")
	button2.SetX(10)
	button2.SetY(60)
	button2.SetWidth(100)
	button2.SetHeight(30)

	button2.Clicked().Attach(func() {
		go NewTalkWindow(mw, 8001, 8000)
		button2.SetEnabled(false)
	})

	mw.SetSize(walk.Size{120, 150})
	mw.Show()

	mw.Run()
}
开发者ID:atree1987,项目名称:MyWorks,代码行数:42,代码来源:main.go


示例5: NewButton

func NewButton(parent walk.Container, text string, width, height, x, y int) *Button {
	b := new(Button)
	b.PushButton, _ = walk.NewPushButton(parent)
	size := walk.Size{width, height}
	b.SetSize(size)
	b.SetMinMaxSize(size, size)
	b.SetY(y)
	b.SetX(x)
	b.SetText(text)

	return b
}
开发者ID:joy999,项目名称:walkwrap,代码行数:12,代码来源:Button.go


示例6: NewLoginWindow

func NewLoginWindow() {
	walk.SetPanicOnError(true)
	myWindow, _ := walk.NewMainWindow()
	mw := &LoginWindow{MainWindow: myWindow}
	//mw.SetLayout(walk.NewVBoxLayout())
	mw.SetTitle("nsq client")

	userLabel, _ := walk.NewLabel(mw)
	userLabel.SetText("用户名:")
	userLabel.SetX(20)
	userLabel.SetY(10)
	userLabel.SetSize(walk.Size{40, 20})

	userEdit, _ := walk.NewLineEdit(mw)
	userEdit.SetReadOnly(false)
	userEdit.SetX(70)
	userEdit.SetY(10)
	userEdit.SetSize(walk.Size{200, 20})
	userEdit.KeyDown().Attach(mw.onKeyDown)
	mw.userEdit = userEdit

	pwdLabel, _ := walk.NewLabel(mw)
	pwdLabel.SetText("密码:")
	pwdLabel.SetX(20)
	pwdLabel.SetY(40)
	pwdLabel.SetSize(walk.Size{40, 20})

	pwdEdit, _ := walk.NewLineEdit(mw)
	pwdEdit.SetReadOnly(false)
	pwdEdit.SetX(70)
	pwdEdit.SetY(40)
	pwdEdit.SetSize(walk.Size{200, 20})
	pwdEdit.KeyDown().Attach(mw.onKeyDown)
	mw.pwdEdit = pwdEdit

	loginBtn, _ := walk.NewPushButton(mw)
	loginBtn.SetText("登陆")
	loginBtn.SetX(120)
	loginBtn.SetY(70)
	loginBtn.SetSize(walk.Size{60, 30})
	loginBtn.Clicked().Attach(mw.loginBtn_OnClick)
	mw.loginBtn = loginBtn

	mw.Show()
	mw.userEdit.SetFocus()
	mw.SetMinMaxSize(walk.Size{300, 150}, walk.Size{})
	mw.SetSize(walk.Size{300, 150})
	mw.Run()
	os.Exit(0)
}
开发者ID:ibmendoza,项目名称:nsq-client,代码行数:50,代码来源:login_window.go


示例7: NewMyPushButton

func NewMyPushButton(parent walk.Container) (*MyPushButton, error) {
	pb, err := walk.NewPushButton(parent)
	if err != nil {
		return nil, err
	}

	mpb := &MyPushButton{pb}

	if err := walk.InitWrapperWidget(mpb); err != nil {
		return nil, err
	}

	return mpb, nil
}
开发者ID:richardjoo,项目名称:walk,代码行数:14,代码来源:externalwidgets.go


示例8: NewPairChatWindow

func NewPairChatWindow(_usr, _partner User) {
	walk.SetPanicOnError(true)
	myWindow, _ := walk.NewMainWindow()

	mw := &PairChatWindow{
		MainWindow: myWindow,
		usr:        _usr,
		partner:    _partner,
		msgChan:    make(chan *NsqMsg, 1),
	}

	mw.SetTitle(fmt.Sprintf("与%s私聊", _partner.Nick))

	msgEdit, _ := walk.NewTextEdit(mw)
	mw.msgEdit = msgEdit
	mw.msgEdit.SetSize(walk.Size{530, 100})
	mw.msgEdit.SetX(10)
	mw.msgEdit.SetY(360)
	mw.msgEdit.SetReadOnly(false)

	chatView, _ := NewChatMsgView(mw)
	mw.chatView = chatView
	mw.chatView.SetSize(walk.Size{530, 350})
	mw.chatView.SetX(10)
	mw.chatView.SetY(5)

	sendBtn, _ := walk.NewPushButton(mw)
	mw.sendBtn = sendBtn
	mw.sendBtn.SetText("发送")
	mw.sendBtn.SetX(480)
	mw.sendBtn.SetY(470)
	mw.sendBtn.SetSize(walk.Size{60, 30})
	mw.sendBtn.Clicked().Attach(mw.sendBtn_OnClick)

	mw.MainWindow.Show()

	mw.msgEdit.SetFocus()
	mw.SetMinMaxSize(walk.Size{565, 550}, walk.Size{565, 550})
	mw.SetSize(walk.Size{565, 550})

	pairChatMgr.register(mw.partner.Id, mw.msgChan)
	go mw.msgRouter()

	mw.MainWindow.Run()
	pairChatMgr.unregister(mw.partner.Id)
}
开发者ID:ibmendoza,项目名称:nsq-client,代码行数:46,代码来源:pairchat_window.go


示例9: main

func main() {
	walk.Initialize(walk.InitParams{PanicOnError: true})
	defer walk.Shutdown()

	myWindow, _ := walk.NewMainWindow()

	myWindow.SetLayout(walk.NewVBoxLayout())
	myWindow.SetTitle("Go GUI example")

	myButton1, _ := walk.NewPushButton(myWindow)
	myButton1.SetText("XXXX")

	lb, _ := walk.NewListBox(myWindow)

	em := NewEnvModel()

	for _, env := range os.Environ() {
		i := strings.Index(env, "=")
		if i == 0 {
			continue
		}
		varName := env[0:i]
		value := env[i+1:]
		envItem := EnvItem{varName, value}

		em.envItems = append(em.envItems, envItem)
	}

	fmt.Println("The len of Model", em.ItemCount())
	lb.SetModel(em)
	lb.CurrentIndexChanged().Attach(func() {
		if curVar, ok := em.Value(lb.CurrentIndex()).(string); ok {
			myButton1.SetText(curVar)
			fmt.Println("CurrentIndex:", lb.CurrentIndex())
			fmt.Println("CurrentEnvVarName:", curVar)
		}
	})
	lb.DblClicked().Attach(func() {
		value := em.envItems[lb.CurrentIndex()].value
		walk.MsgBox(myWindow, "About", value, walk.MsgBoxOK|walk.MsgBoxIconInformation)
	})
	myWindow.Show()
	myWindow.SetMinMaxSize(walk.Size{320, 240}, walk.Size{})
	myWindow.SetSize(walk.Size{400, 500})
	myWindow.Run()
}
开发者ID:hoperuin,项目名称:walk,代码行数:46,代码来源:listbox.go


示例10: NewTalkWindow

func NewTalkWindow(mv *MainWindow, listenPort int, sendPort int) {
	walk.Initialize(walk.InitParams{PanicOnError: true})
	defer walk.Shutdown()

	talkWnd, err := walk.NewMainWindow()
	if err != nil {
		return
	}

	tw := &TalkWindow{MainWindow: talkWnd, ListenPort: listenPort, SendPort: sendPort}

	tw.SetTitle("I'm listing in" + strconv.Itoa(tw.ListenPort))

	tw.ShowText, _ = walk.NewTextEdit(tw)
	tw.ShowText.SetX(10)
	tw.ShowText.SetY(10)
	tw.ShowText.SetWidth(280)
	tw.ShowText.SetHeight(300)
	tw.ShowText.SetReadOnly(true)

	tw.SendText, _ = walk.NewTextEdit(tw)
	tw.SendText.SetX(10)
	tw.SendText.SetY(320)
	tw.SendText.SetWidth(200)
	tw.SendText.SetHeight(30)

	button1, _ := walk.NewPushButton(tw)
	button1.SetText("发送")
	button1.SetX(220)
	button1.SetY(320)
	button1.SetWidth(70)
	button1.SetHeight(30)
	button1.Clicked().Attach(func() {
		tw.Send()
	})

	tw.SetSize(walk.Size{320, 400})
	tw.Show()

	go tw.Listen()
	tw.Run()
}
开发者ID:atree1987,项目名称:MyWorks,代码行数:42,代码来源:im.go


示例11: main

func main() {
	walk.Initialize(walk.InitParams{PanicOnError: true})
	defer walk.Shutdown()

	rand.Seed(time.Now().UnixNano())

	mainWnd, _ := walk.NewMainWindow()

	mw := &MainWindow{
		MainWindow: mainWnd,
		model:      NewFooModel(),
	}

	mw.SetLayout(walk.NewVBoxLayout())
	mw.SetTitle("Walk TableView Example")

	resetRowsButton, _ := walk.NewPushButton(mw)
	resetRowsButton.SetText("Reset Rows")

	resetRowsButton.Clicked().Attach(func() {
		// Get some fresh data.
		mw.model.ResetRows()
	})

	tableView, _ := walk.NewTableView(mw)

	tableView.SetAlternatingRowBGColor(walk.RGB(255, 255, 224))
	tableView.SetReorderColumnsEnabled(true)

	// Everybody loves check boxes.
	tableView.SetCheckBoxes(true)

	// Don't forget to set the model.
	tableView.SetModel(mw.model)

	mw.SetMinMaxSize(walk.Size{320, 240}, walk.Size{})
	mw.SetSize(walk.Size{800, 600})
	mw.Show()

	mw.Run()
}
开发者ID:etel,项目名称:walk,代码行数:41,代码来源:tableview.go


示例12: Create

func (pb PushButton) Create(parent walk.Container) error {
	w, err := walk.NewPushButton(parent)
	if err != nil {
		return err
	}

	return InitWidget(pb, w, func() error {
		if err := w.SetText(pb.Text); err != nil {
			return err
		}

		if pb.OnClicked != nil {
			w.Clicked().Attach(pb.OnClicked)
		}

		if pb.AssignTo != nil {
			*pb.AssignTo = w
		}

		return nil
	})
}
开发者ID:etel,项目名称:walk,代码行数:22,代码来源:pushbutton.go


示例13: initPoseInfo


//.........这里部分代码省略.........
	exitAction := walk.NewAction()
	exitAction.SetText("E&xit")
	exitAction.Triggered().Attach(func() { walk.App().Exit(0) })
	fileMenu.Actions().Add(exitAction)
}

func (mw *MainWindow) initCanvas() {
	for i := 0; i < POSE_CNT_MAX; i++ {
		iv, _ := selfWidget.NewMyImageView(mw)
		mw.imageView[i] = iv
	}
}
func (mw *MainWindow) initOtherBars() {
	sp, _ := walk.NewSplitter(mw)
	sp.SetSize(walk.Size{400, 20})

	lab, _ := walk.NewLabel(sp)
	lab.SetSize(walk.Size{16, 30})
	// lab.SetText("Pose")

	// others
	mw.uiFrameCnt, _ = walk.NewNumberEdit(sp)
	//mw.uiFrameCnt.SetSize(walk.Size{42, TB_H})
	mw.uiFrameCnt.SetRange(1, 100)
	mw.uiFrameCnt.SetDecimals(0)
	mw.uiFrameCnt.SetValue(8)
	mw.uiFrameCnt.SetEnabled(false)
	mw.uiFrameCnt.SetToolTipText(ttPlayPose)

	mw.uiPoseCnt, _ = walk.NewNumberEdit(sp)
	//mw.uiPoseCnt.SetSize(walk.Size{42, TB_H})
	mw.uiPoseCnt.SetRange(1, 100)
	mw.uiPoseCnt.SetValue(1)
	mw.uiPoseCnt.SetDecimals(0)
	mw.uiPoseCnt.SetToolTipText(ttPosCnt)

	mw.uiAddBoundY, _ = walk.NewNumberEdit(sp)
	mw.uiAddBoundY.SetRange(1, 1000)
	mw.uiAddBoundY.SetValue(0)
	mw.uiAddBoundY.SetDecimals(0)
	mw.uiAddBoundY.ValueChanged().Attach(func() {
		yBoundAdd = int(mw.uiAddBoundY.Value())
		if yBoundAdd < -imageH {
			yBoundAdd = -imageH
		}
		if yBoundAdd > (imageH - boundary.Max.Y) {
			yBoundAdd = imageH - boundary.Max.Y
		}
		mw.uiAddBoundY.SetValue(float64(yBoundAdd))
		mw.setImageSize()
	})

	mw.uiConvirm, _ = walk.NewPushButton(sp)
	mw.uiConvirm.SetText("OK")
	mw.uiConvirm.Clicked().Attach(func() {
		// Get some fresh data.
		// mw.onUiSetFrameCnt()
	})

	walk.InitWidget(sp, mw, FREEZEIZE_CLASS,
		winapi.CCS_NORESIZE,
		winapi.WS_EX_TOOLWINDOW|winapi.WS_EX_WINDOWEDGE)
}

func newMainWindow() {
	walk.SetPanicOnError(true)
	mainWnd, _ := walk.NewMainWindow()

	mw := &MainWindow{MainWindow: mainWnd}
	mw.viewGrid = walk.NewGridLayout()
	mw.SetLayout(mw.viewGrid)
	mw.viewGrid.SetRowStretchFactor(GRID_CNT, 2)
	mw.viewGrid.SetColumnStretchFactor(GRID_CNT, 2)
	mw.viewGrid.SetMargins(walk.Margins{6, 28, 2, 6})

	mw.SetTitle("Image composer")

	mw.initMenu()
	mw.initOtherBars()
	mw.initCanvas()

	mw.SetMinMaxSize(walk.Size{800, 600}, walk.Size{})
	mw.SetSize(walk.Size{800, 600})

	mw.refreshToolBar(MODE_INVALID)
	mw.Show()
	mw.Run()
}

func init() {
	walk.MustRegisterWindowClass(FREEZEIZE_CLASS)
	runtime.GOMAXPROCS(2)

	screenW = int(winapi.GetSystemMetrics(winapi.SM_CXSCREEN))
	screenH = int(winapi.GetSystemMetrics(winapi.SM_CYSCREEN))
}

func main() {
	newMainWindow()
}
开发者ID:hemaolong,项目名称:Rabbit,代码行数:101,代码来源:main.go


示例14: init

func (w *MyDialog) init(owner walk.RootWidget) (err error) {
	if w.Dialog, err = walk.NewDialog(owner); err != nil {
		return err
	}

	succeeded := false
	defer func() {
		if !succeeded {
			w.Dispose()
		}
	}()

	var font *walk.Font
	if font == nil {
		font = nil
	}

	w.SetName("Dialog")
	if err := w.SetClientSize(walk.Size{598, 300}); err != nil {
		return err
	}
	if err := w.SetTitle(`Dialog`); err != nil {
		return err
	}

	// noProgressBtn
	if w.ui.noProgressBtn, err = walk.NewPushButton(w); err != nil {
		return err
	}
	w.ui.noProgressBtn.SetName("noProgressBtn")
	if err := w.ui.noProgressBtn.SetBounds(walk.Rectangle{40, 60, 161, 23}); err != nil {
		return err
	}
	if err := w.ui.noProgressBtn.SetText(`NoProgress`); err != nil {
		return err
	}
	if err := w.ui.noProgressBtn.SetMinMaxSize(walk.Size{0, 0}, walk.Size{161, 16777215}); err != nil {
		return err
	}

	// indeterminateBtn
	if w.ui.indeterminateBtn, err = walk.NewPushButton(w); err != nil {
		return err
	}
	w.ui.indeterminateBtn.SetName("indeterminateBtn")
	if err := w.ui.indeterminateBtn.SetBounds(walk.Rectangle{40, 90, 161, 23}); err != nil {
		return err
	}
	if err := w.ui.indeterminateBtn.SetText(`Indeterminate`); err != nil {
		return err
	}
	if err := w.ui.indeterminateBtn.SetMinMaxSize(walk.Size{0, 0}, walk.Size{161, 16777215}); err != nil {
		return err
	}

	// normalBtn
	if w.ui.normalBtn, err = walk.NewPushButton(w); err != nil {
		return err
	}
	w.ui.normalBtn.SetName("normalBtn")
	if err := w.ui.normalBtn.SetBounds(walk.Rectangle{40, 120, 161, 23}); err != nil {
		return err
	}
	if err := w.ui.normalBtn.SetText(`Normal`); err != nil {
		return err
	}
	if err := w.ui.normalBtn.SetMinMaxSize(walk.Size{0, 0}, walk.Size{161, 16777215}); err != nil {
		return err
	}

	// errBtn
	if w.ui.errBtn, err = walk.NewPushButton(w); err != nil {
		return err
	}
	w.ui.errBtn.SetName("errBtn")
	if err := w.ui.errBtn.SetBounds(walk.Rectangle{40, 150, 161, 23}); err != nil {
		return err
	}
	if err := w.ui.errBtn.SetText(`Error`); err != nil {
		return err
	}

	// pausedBtn
	if w.ui.pausedBtn, err = walk.NewPushButton(w); err != nil {
		return err
	}
	w.ui.pausedBtn.SetName("pausedBtn")
	if err := w.ui.pausedBtn.SetBounds(walk.Rectangle{40, 180, 161, 23}); err != nil {
		return err
	}
	if err := w.ui.pausedBtn.SetText(`Paused`); err != nil {
		return err
	}

	// startBtn
	if w.ui.startBtn, err = walk.NewPushButton(w); err != nil {
		return err
	}
	w.ui.startBtn.SetName("startBtn")
	if err := w.ui.startBtn.SetBounds(walk.Rectangle{290, 180, 75, 23}); err != nil {
//.........这里部分代码省略.........
开发者ID:karlma,项目名称:walk,代码行数:101,代码来源:dialog_ui.go


示例15: NewGroupChatWindow

func NewGroupChatWindow(_usr User) {
	walk.SetPanicOnError(true)
	myWindow, _ := walk.NewMainWindow()

	mw := &GroupChatWindow{
		MainWindow: myWindow,
		usr:        _usr,
		usrModel:   NewUsrModel(),
	}

	mw.SetTitle("简易群聊:" + _usr.Nick)

	usrList, _ := walk.NewListBox(mw)
	mw.usrList = usrList
	mw.usrList.SetModel(mw.usrModel)
	mw.usrList.SetSize(walk.Size{100, 450})
	mw.usrList.SetX(10)
	mw.usrList.SetY(5)
	mw.usrList.ItemActivated().Attach(mw.userlist_ItemActivated)
	mw.usrList.CurrentIndexChanged().Attach(mw.userlist_CurrentIndexChanged)

	msgEdit, _ := walk.NewTextEdit(mw)
	mw.msgEdit = msgEdit
	mw.msgEdit.SetSize(walk.Size{500, 100})
	mw.msgEdit.SetX(120)
	mw.msgEdit.SetY(310)
	mw.msgEdit.SetReadOnly(false)

	chatView, _ := NewChatMsgView(mw)
	mw.chatView = chatView
	mw.chatView.SetSize(walk.Size{500, 300})
	mw.chatView.SetX(120)
	mw.chatView.SetY(5)

	sendBtn, _ := walk.NewPushButton(mw)
	mw.sendBtn = sendBtn
	mw.sendBtn.SetText("发送")
	mw.sendBtn.SetX(560)
	mw.sendBtn.SetY(420)
	mw.sendBtn.SetSize(walk.Size{60, 30})
	mw.sendBtn.Clicked().Attach(mw.sendBtn_OnClick)

	mw.MainWindow.Show()

	mw.msgEdit.SetFocus()
	mw.SetMinMaxSize(walk.Size{645, 500}, walk.Size{645, 500})
	mw.SetSize(walk.Size{645, 500})

	mw.chatMgr = &ChatMgr{
		topic:   "imtech",
		channel: mw.usr.Id,
		msgChan: make(chan *NsqMsg, 1),
	}
	go Receiver.registerMsgHandler(mw.chatMgr)
	go mw.msgRouter()

	mw.MainWindow.Run()
	mw.chatMgr.reader.Stop()
	Publisher.Stop()
	pairChatMgr.release()
	os.Exit(0)

}
开发者ID:ibmendoza,项目名称:nsq-client,代码行数:63,代码来源:groupchat_window.go


示例16: init

func (mw *MyWindow) init() (err error) {
	// 设置最小化
	mw.SetMinimizeBox(true)
	// 禁用最大化
	mw.SetMaximizeBox(false)
	// 设置窗口固定
	mw.SetFixedSize(true)
	// // 设置窗口前置
	// mw.SetWindowPos(true)

	mw.MainWindow, err = walk.NewMainWindow()
	mw.checkError(err)

	succeeded := false
	defer func() {
		if !succeeded {
			mw.Dispose()
		}
	}()

	// 设置主窗体大小
	err = mw.SetClientSize(walk.Size{700, 560})
	mw.checkError(err)

	// 设置主窗体标题
	err = mw.SetTitle("iMan-打包工具   V【" + _VERSION_ + "】")
	mw.checkError(err)

	// 设置
	mw.ui.SettingMenu, _ = walk.NewMenu()
	mw.ui.SettingAction = walk.NewMenuAction(mw.ui.SettingMenu)
	mw.ui.SettingAction.SetText("设置")

	mw.ui.ServerAction = walk.NewAction()
	mw.ui.ServerAction.SetText("服务器")

	mw.ui.SettingMenu.Actions().Add(mw.ui.ServerAction)

	// 帮助
	mw.ui.HelpMenu, _ = walk.NewMenu()
	mw.ui.HelpAction = walk.NewMenuAction(mw.ui.HelpMenu)
	mw.ui.HelpAction.SetText("帮助")

	mw.ui.AboutAction = walk.NewAction()
	mw.ui.AboutAction.SetText("关于")

	mw.ui.HelpMenu.Actions().Add(mw.ui.AboutAction)

	// 菜单配置
	mw.Menu().Actions().Add(mw.ui.SettingAction)
	mw.Menu().Actions().Add(mw.ui.HelpAction)

	// 设置字体和图标
	fountTitle, _ := walk.NewFont("幼圆", 10, walk.FontBold)
	otherFont, _ := walk.NewFont("幼圆", 10, 0)

	// 编译服务器IP
	mw.ui.BuildServerLb, err = walk.NewLabel(mw)
	mw.checkError(err)

	mw.ui.BuildServerLb.SetText("编译服务器IP: " + ConfSer.Ip)
	mw.ui.BuildServerLb.SetFont(otherFont)

	mw.ui.BuildServerLb.SetBounds(walk.Rectangle{480, 10, 220, 20})

	// 开始打包
	mw.ui.StartPackingBtn, err = walk.NewPushButton(mw)
	mw.checkError(err)

	mw.ui.StartPackingBtn.SetText("开始打包")

	mw.ui.StartPackingBtn.SetBounds(walk.Rectangle{310, 20, 75, 30})

	// 版本配置
	mw.ui.VersionGb, err = walk.NewGroupBox(mw)
	mw.checkError(err)
	mw.ui.VersionGb.SetTitle("版本配置")
	mw.ui.VersionGb.SetFont(otherFont)

	err = mw.ui.VersionGb.SetBounds(walk.Rectangle{10, 60, 330, 260})
	mw.checkError(err)

	// 版本类型
	mw.ui.VersionTypeLb, err = walk.NewLabel(mw.ui.VersionGb)
	mw.checkError(err)

	mw.ui.VersionTypeLb.SetText("版本类型:")
	mw.ui.VersionTypeLb.SetFont(fountTitle)

	mw.ui.VersionTypeLb.SetBounds(walk.Rectangle{10, 20, 70, 25})

	// 测试版
	mw.ui.VersionTestRadio, err = walk.NewRadioButton(mw.ui.VersionGb)
	mw.checkError(err)

	mw.ui.VersionTestRadio.SetText("测试版")

	mw.ui.VersionTestRadio.SetBounds(walk.Rectangle{110, 20, 60, 25})
	mw.ui.VersionTestRadio.SetChecked(true)

//.........这里部分代码省略.........
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:101,代码来源:upgrideiMan_ui.go


示例17: init

func (mw *MyWindow) init() (err error) {
	// 设置最小化
	mw.SetMinimizeBox(true)
	// 禁用最大化
	mw.SetMaximizeBox(false)
	// 设置窗口固定
	mw.SetFixedSize(true)
	// // 设置窗口前置
	// mw.SetWindowPos(true)

	mw.MainWindow, err = walk.NewMainWindow()
	mw.checkError(err)

	succeeded := false
	defer func() {
		if !succeeded {
			mw.Dispose()
		}
	}()

	// 设置主窗体大小
	err = mw.SetClientSize(walk.Size{800, 560})
	mw.checkError(err)

	// 设置主窗体标题
	err = mw.SetTitle("iMan-打包工具   V【" + _VERSION_ + "】")
	mw.checkError(err)

	mw.ui.PushButton1, err = walk.NewPushButton(mw)
	mw.checkError(err)
	mw.ui.PushButton1.SetText("刷新")
	mw.ui.PushButton1.SetBounds(walk.Rectangle{300, 10, 50, 30})

	// 获取
	mw.ui.PushButton2, err = walk.NewPushButton(mw)
	mw.checkError(err)
	mw.ui.PushButton2.SetText("获取")
	mw.ui.PushButton2.SetBounds(walk.Rectangle{400, 10, 50, 30})

	// 打包日志 TabWidget
	mw.ui.PackTabWidget, err = walk.NewTabWidget(mw)
	mw.checkError(err)
	mw.ui.PackTabWidget.SetBounds(walk.Rectangle{5, 50, 780, 500})

	// 历史版本记录 TabPage
	mw.ui.VersionPage, err = walk.NewTabPage()
	mw.ui.VersionPage.SetTitle("历史版本记录")

	// TabPage 添加到 TabWidget
	mw.ui.PackTabWidget.Pages().Add(mw.ui.VersionPage)

	// 历史版本记录 TableView
	mw.ui.VersionTableView, err = walk.NewTableView(mw.ui.VersionPage)
	mw.ui.VersionTableView.SetCheckBoxes(true)
	mw.ui.VersionTableView.SetBounds(walk.Rectangle{10, 10, 770, 460})

	mw.checkError(err)

	// 历史版本记录 - 序号
	mw.ui.VersionTabVieConIndex = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConIndex.SetTitle("序号")
	mw.ui.VersionTabVieConIndex.SetWidth(50)

	// 历史版本记录 - 主版本
	mw.ui.VersionTabVieConMastVer = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConMastVer.SetTitle("主版本")
	mw.ui.VersionTabVieConMastVer.SetWidth(60)

	// 历史版本记录 - 版本
	mw.ui.VersionTabVieConVer = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConVer.SetTitle("版本")
	mw.ui.VersionTabVieConVer.SetWidth(100)

	// 历史版本记录 - 打包内容
	mw.ui.VersionTabVieConPack = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConPack.SetTitle("打包内容")
	mw.ui.VersionTabVieConPack.SetWidth(120)

	// 历史版本记录 - 是否打Tag
	mw.ui.VersionTabVieConTag = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConTag.SetTitle("Tag")
	mw.ui.VersionTabVieConTag.SetWidth(120)

	// 历史版本记录 - Tag 路径
	mw.ui.VersionTabVieConTagPath = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConTagPath.SetTitle("Tag路径")
	mw.ui.VersionTabVieConTagPath.SetWidth(150)

	// 历史版本记录 - 打包时间
	mw.ui.VersionTabVieConTime = walk.NewTableViewColumn()
	mw.ui.VersionTabVieConTime.SetTitle("打包时间")
	mw.ui.VersionTabVieConTime.SetWidth(150)
	mw.ui.VersionTabVieConTime.SetFormat(layoutTime)

	// TableViewColumn 添加到 TableView
	mw.ui.VersionTableView.Columns().Add(mw.ui.VersionTabVieConIndex)
	mw.ui.VersionTableView.Columns().Add(mw.ui.VersionTabVieConMastVer)
	mw.ui.VersionTableView.Columns().Add(mw.ui.VersionTabVieConVer)
	mw.ui.VersionTableView.Columns().Add(mw.ui.VersionTabVieConPack)
	mw.ui.VersionTableView.Columns().Add(mw.ui.VersionTabVieConTag)
//.........这里部分代码省略.........
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:101,代码来源:ui.go


示例18: init

func (mw *MyDialog) init(owner walk.Form) (err error) {
	// 设置最小化
	mw.SetMinimizeBox(true)
	// 禁用最大化
	mw.SetMaximizeBox(false)
	// 设置窗口固定
	mw.SetFixedSize(true)

	mw.Dialog, err = walk.NewDialogCody(owner)
	mw.checkError(err)

	succeeded := false
	defer func() {
		if !succeeded {
			mw.Dispose()
		}
	}()

	// 设置主窗体大小
	mw.SetClientSize(walk.Size{376, 287})
	mw.checkError(err)

	// 居中
	mw.SetScreenCenter(true)

	// 设置主窗体在所有窗体之前
	mw.SetForegroundWindow()
	mw.SwitchToThisWindow(true)

	// 设置主窗体标题
	mw.SetTitle("iMan-升级工具   V【" + _VERSION_ + "】")
	mw.checkError(err)

	// 设置上传组合窗体
	mw.ui.uploadGb, err = walk.NewGroupBox(mw)
	mw.checkError(err)

	err = mw.ui.uploadGb.SetTitle("升级包上传")
	mw.checkError(err)

	err = mw.ui.uploadGb.SetBounds(walk.Rectangle{3, 7, 368, 138})
	mw.checkError(err)

	// 升级包
	mw.ui.fileLb, err = walk.NewLabel(mw.ui.uploadGb)
	mw.checkError(err)

	err = mw.ui.fileLb.SetText("升级包:")
	mw.checkError(err)

	err = mw.ui.fileLb.SetBounds(walk.Rectangle{10, 33, 70, 25})
	mw.checkError(err)

	// 上传路径
	mw.ui.fileLe, err = walk.NewLineEdit(mw.ui.uploadGb)
	mw.checkError(err)

	err = mw.ui.fileLe.SetBounds(walk.Rectangle{96, 33, 166, 25})
	mw.checkError(err)

	err = mw.ui.fileLe.SetReadOnly(true)
	mw.checkError(err)

	// 浏览按钮
	mw.ui.browseBtn, err = walk.NewPushButton(mw.ui.uploadGb)
	mw.checkError(err)

	err = mw.ui.browseBtn.SetText("浏览")
	mw.checkError(err)

	err = mw.ui.browseBtn.SetBounds(walk.Rectangle{288, 34, 55, 25})
	mw.checkError(err)

	mw.ui.browseBtn.SetCursor(walk.CursorHand())

	// 服务器IP lb
	mw.ui.ipLb, err = walk.NewLabel(mw.ui.uploadGb)
	mw.checkError(err)

	err = mw.ui.ipLb.SetText("服务器IP:")
	mw.checkError(err)

	err = mw.ui.ipLb.SetBounds(walk.Rectangle{10, 94, 70, 25})
	mw.checkError(err)

	// 服务器IP le
	mw.ui.ipLe, err = walk.NewLineEdit(mw.ui.uploadGb)
	mw.checkError(err)

	err = mw.ui.ipLe.SetBounds(walk.Rectangle{96, 92, 166, 25})
	mw.checkError(err)

	// 控制IP输入长度为15
	mw.ui.ipLe.SetMaxLength(15)

	// 上传按钮
	mw.ui.uploadBtn, err = walk.NewPushButton(mw.ui.uploadGb)
	mw.checkError(err)

	// // // 设置背景
//.........这里部分代码省略.........
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:101,代码来源:upgrideiMan_ui.go


示例19: init


//.........这里部分代码省略.........
	mw.checkError(err)

	mw.ui.mailSubLb.SetText("邮件主题:")
	err = mw.ui.mailSubLb.SetBounds(walk.Rectangle{8, 20, 80, 20})
	mw.checkError(err)

	// 邮件主题编辑框
	mw.ui.mailSubLe, err = walk.NewLineEdit(mw.ui.mailContentGb)
	mw.checkError(err)
	mw.ui.mailSubLe.SetText(MS.Subject)

	err = mw.ui.mailSubLe.SetBounds(walk.Rectangle{110, 20, 150, 20})
	mw.checkError(err)

	// 邮件内容
	mw.ui.mailBodyLb, err = walk.NewLabel(mw.ui.mailContentGb)
	mw.checkError(err)

	mw.ui.mailBodyLb.SetText("邮件内容:")
	err = mw.ui.mailBodyLb.SetBounds(walk.Rectangle{8, 50, 80, 20})
	mw.checkError(err)

	// 邮件内容编辑框
	mw.ui.mailBodyLe, err = walk.NewTextEdit(mw.ui.mailContentGb)
	mw.checkError(err)

	mw.ui.mailBodyLe.SetText(MS.Body)

	err = mw.ui.mailBodyLe.SetBounds(walk.Rectangle{110, 50, 280, 100})
	mw.checkError(err)

	// 附件
	mw.ui.mailAdjLb, err = walk.NewLabel(mw.ui.mailContentGb)
	mw.checkError(err)

	mw.ui.mailAdjLb.SetText("附件:")
	err = mw.ui.mailAdjLb.SetBounds(walk.Rectangle{8, 160, 80, 20})
	mw.checkError(err)

	// 附件编辑框
	mw.ui.mailAdjLe, err = walk.NewLineEdit(mw.ui.mailContentGb)
	mw.checkError(err)

	err = mw.ui.mailAdjLe.SetBounds(walk.Rectangle{110, 160, 150, 20})
	mw.checkError(err)

	mw.ui.mailAdjLe.SetText(MS.Adjunct)

	mw.ui.mailAdjLe.SetReadOnly(true)

	// 浏览
	mw.ui.browseBtn, err = walk.NewPushButton(mw.ui.mailContentGb)
	mw.checkError(err)
	mw.ui.browseBtn.SetText("浏览")
	err = mw.ui.browseBtn.SetBounds(walk.Rectangle{270, 155, 35, 30})
	mw.checkError(err)

	// 日志
	mw.ui.logLb, err = walk.NewLabel(mw)
	mw.checkError(err)

	mw.ui.logLb.SetText("日志")

	err = mw.ui.logLb.SetBounds(walk.Rectangle{185, 325, 30, 20})
	mw.checkError(err)

	// 日志输出
	mw.ui.lv, err = NewLogView(mw)
	mw.checkError(err)

	err = mw.ui.lv.SetBounds(walk.Rectangle{185, 345, 405, 70})
	mw.checkError(err)

	log.SetOutput(mw.ui.lv)

	// 发送邮件
	mw.ui.sendBtn, err = walk.NewPushButton(mw)
	mw.checkError(err)

	mw.ui.sendBtn.SetText("开始发送")

	err = mw.ui.sendBtn.SetBounds(walk.Rectangle{350, 420, 80, 30})
	mw.checkError(err)

	// // 设置背景
	// color := walk.RGB(255, 0, 0)
	// bg, _ := walk.NewSolidColorBrush(color)
	// mw.SetBackground(bg)

	// 设置字体和图标
	fount, _ := walk.NewFont("宋体", 11, 0)
	mw.SetFont(fount)
	mw.ui.mailListGb.SetFont(fount)
	mw.ui.mailServerGb.SetFont(fount)
	mw.ui.mailContentGb.SetFont(fount)

	succeeded = true

	return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:101,代码来源:main-ui.go


示例20: init

func (dlg *DlgServer) init(owner walk.Form) (err error) {
	dlg.Dialog, err = walk.NewDialogWithFixedSize(owner)
	dlg.checkError(err)

	// 读取配置文件
	ConfSer.Read()

	succeeded := false
	defer func() {
		if !succeeded {
			dlg.Dispose()
		}
	}()

	// 设置主窗体大小
	err = dlg.SetClientSize(walk.Size{250, 180})
	dlg.checkError(err)

	// 设置窗体标题
	err = dlg.SetTitle("服务器设置")
	dlg.checkError(err)

	// 设置字体和图标
	fountTitle, _ := walk.NewFont("幼圆", 10, walk.FontBold)
	fountOther, _ := walk.NewFont("幼圆", 10, 0)

	// IP标题
	dlg.ui.IpLb, err = walk.NewLabel(dlg)
	dlg.ui.IpLb.SetText("IP:")
	dlg.ui.IpLb.SetFont(fountTitle)
	dlg.ui.IpLb.SetBounds(walk.Rectangle{30, 20, 60, 20})

	// IP编辑框
	dlg.ui.IpLe, err = walk.NewLineEdit(dlg)
	dlg.ui.IpLe.SetBounds(walk.Rectangle{100, 20, 120, 20})
	dlg.ui.IpLe.SetFont(fountOther)
	dlg.ui.IpLe.SetText(ConfSer.Ip)
	dlg.ui.IpLe.SetMaxLength(15)

	// 用户名标题
	dlg.ui.UserLb, err = walk.NewLabel(dlg)
	dlg.ui.UserLb.SetText("用户名:")
	dlg.ui.UserLb.SetFont(fountTitle)

	dlg.ui.UserLb.SetBounds(walk.Rectangle{30, 60, 60, 20})

	// 用户名编辑框
	dlg.ui.UserLe, err = walk.NewLineEdit(dlg)
	dlg.ui.UserLe.SetBounds(walk.Rectangle{100, 60, 120, 20})
	dlg.ui.UserLe.SetFont(fountOther)
	dlg.ui.UserLe.SetText(ConfSer.User)

	// 密码标题
	dlg.ui.PasswdLb, err = walk.NewLabel(dlg)
	dlg.ui.PasswdLb.SetText("密码:")
	dlg.ui.PasswdLb.SetFont(fountTitle)

	dlg.ui.PasswdLb.SetBounds(walk.Rectangle{30, 100, 60, 20})

	// 密码编辑框
	dlg.ui.PasswdLe, err = walk.NewLineEdit(dlg)
	dlg.ui.PasswdLe.SetBounds(walk.Rectangle{100, 100, 120, 20})
	dlg.ui.PasswdLe.SetPasswordMode(true)
	dlg.ui.PasswdLe.SetText(ConfSer.Passwd)

	// 确定
	dlg.ui.AcceptPB, err = walk.NewPushButton(dlg)
	dlg.ui.AcceptPB.SetText("确定")

	dlg.ui.AcceptPB.SetBounds(walk.Rectangle{150, 140, 70, 25})

	// 设置图标
	icon, _ := walk.NewIconFromResourceId(3)
	dlg.SetIcon(icon)

	succeeded = true

	return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:79,代码来源:setting_ui.go



注:本文中的github.com/lxn/walk.NewPushButton函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang walk.RGB函数代码示例发布时间:2022-05-23
下一篇:
Golang walk.NewMenu函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap