Browse Source

create events under UI

cuu 5 years ago
parent
commit
0a1944ef80
4 changed files with 12 additions and 4 deletions
  1. 4 2
      main.go
  2. 6 0
      sysgo/UI/events.go
  3. 1 1
      sysgo/UI/main_screen.go
  4. 1 1
      test.go

+ 4 - 2
main.go

@@ -46,7 +46,9 @@ func run() int {
 	UI.SwapAndShow()
 	
 	fmt.Println(main_screen)
-	
+    
+    event.AddCustomEvent(UI.RUNEVT)
+
 	running := true
 	for running {
 		ev := event.Wait()
@@ -65,7 +67,7 @@ func run() int {
 			}else if ev.Data["Key"] == "D" {
 				time.Delay(1000)
 			}else if ev.Data["Key"] == "P" {				
-				event.Post(event.RUNEVT,"GODEBUG=cgocheck=0 sucks") // just id and string, simpify the stuff
+				event.Post(UI.RUNEVT,"GODEBUG=cgocheck=0 sucks") // just id and string, simpify the stuff
 				
 			}else {
 				main_screen.KeyDown(ev)

+ 6 - 0
sysgo/UI/events.go

@@ -0,0 +1,6 @@
+package UI
+
+
+const (
+    RUNEVT=1
+)

+ 1 - 1
sysgo/UI/main_screen.go

@@ -393,7 +393,7 @@ func (self *MainScreen) RunEXE( cmdpath string) {
 	cmdpath = strings.Trim(cmdpath," ")
 	cmdpath = CmdClean(cmdpath)
 	
-	event.Post(event.RUNEVT,cmdpath)
+	event.Post(RUNEVT,cmdpath)
 	
 }
 

+ 1 - 1
test.go

@@ -106,7 +106,7 @@ func run() int {
 				time.Delay(1000)
 			}
 			if ev.Data["Key"] == "P" {				
-				event.Post(event.RUNEVT,"GODEBUG=cgocheck=0 sucks") // just id and string, simpify the stuff
+				event.Post(event.RUNEVT,"GODEBUG=cgocheck=0 sucks") // just id and string, simplify the stuff
 			}
 		}
 	}