Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Windows: Menu width not restored when making text narrower #66

@kokororin

Description

@kokororin

Set the title of a menu to a longer character, then restore it. The width of the menu will not be restored.

image
image
image

minimal reproducible example:

package main

import (
	"fmt"
	"time"

	"fyne.io/systray"
	"fyne.io/systray/example/icon"
)

func main() {
	onExit := func() {
		now := time.Now()
		fmt.Println("Exit at", now.String())
	}

	systray.Run(onReady, onExit)
}

func addQuitItem() {
	mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
	mQuit.Enable()
	go func() {
		<-mQuit.ClickedCh
		fmt.Println("Requesting quit")
		systray.Quit()
		fmt.Println("Finished quitting")
	}()
	systray.AddSeparator()
}

func onReady() {
	systray.SetTemplateIcon(icon.Data, icon.Data)
	systray.SetTitle("Awesome App")
	systray.SetTooltip("Lantern")
	addQuitItem()

	// We can manipulate the systray in other goroutines
	go func() {
		systray.SetTitle("Awesome App")
		systray.SetTooltip("Pretty awesome棒棒嗒")
		mChange := systray.AddMenuItem("Change Me", "Change Me")
		mRestore := systray.AddMenuItem("Restore Me", "Restore Me")

		systray.AddMenuItem("Ignored", "Ignored")

		for {
			select {
			case <-mChange.ClickedCh:
				mChange.SetTitle("I've Changed, hahahahahaha")
			case <-mRestore.ClickedCh:
				mChange.SetTitle("Change Me")
			}
		}
	}()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS:WindowsOnly occurs on the Windows operating system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions