issue with mouse unfocusing window
Author |
Message |
frank26080115
|
Posted: Mon Oct 16, 2006 5:09 pm Post subject: issue with mouse unfocusing window |
|
|
ok this should write "test" into the bottom window when you click inside the top window, and it works most of the time, but if you click out side the window and then click inside the window, nothing happens, and i don't know what's wrong with it because im telling it "window:select" "window:setactive" and "window:show" every step of the way
code: | %variables
var buttonwindow : int
var textwindow : int
%based on screen resolution
var screenwidth : int := 1000
var screenheight : int := 200
var screenwidthtext : int := screenwidth div 8
var screenheighttext : int := screenheight div 7
var displayline : string
%mouse position and button up/down
var mousex : int := 0
var mousey : int := 0
var mousebutton : int := 0
%var : :=
%procedures
%to make sure this window stays on top
procedure showwin1
Window.Select (buttonwindow)
Window.SetActive (buttonwindow)
Window.Show (buttonwindow)
end showwin1
%to make sure this window stays on top
procedure showwin2
Window.Select (textwindow)
%Window.SetActive (textwindow)
Window.Show (textwindow)
end showwin2
%opens windows
buttonwindow := Window.Open ("position:center;top,graphics:" + intstr (screenwidth) + ";" + intstr (screenheight) + ",buttonbar")
textwindow := Window.Open ("position:center;bottom,text:" + intstr (screenheighttext) + ";" + intstr (screenwidthtext) + ",buttonbar,title:Source Code")
%Intro Line, will be shown as a comment in Basic
put ";Source Code Written With the Basic Atom Writer by Frank26080115"
%put a "write to file" script here
loop
showwin1
loop
showwin1
Mouse.Where (mousex, mousey, mousebutton)
%Choose Syntax
%this part is to be writen, will consist of buttons
exit when mousebutton = 1
end loop
loop
showwin1
Mouse.Where (mousex, mousey, mousebutton)
%Exit when mouse button is let go
exit when mousebutton = 0
end loop
loop
showwin1
%only exit if within screen
if mousex >= 0 and mousex <= screenwidth and mousey >= 0 and mousey <= screenheight then
exit
end if
end loop
displayline := "test"
showwin2
put displayline
%put a "write to file" script here
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
jamonathin
|
Posted: Mon Oct 16, 2006 6:43 pm Post subject: (No subject) |
|
|
You are going to kick yourself, but to solve your problem all you have to do is put:
code: |
Mouse.Where (mousex, mousey, mousebutton) |
into your third - inside loop. |
|
|
|
|
|
Windsurfer
|
Posted: Mon Oct 16, 2006 6:51 pm Post subject: (No subject) |
|
|
Ha, ouch, embarrasing, but it happens to the best of us. Like in C, for me, I always get caught mixing up the = and == operators. |
|
|
|
|
|
frank26080115
|
Posted: Mon Oct 16, 2006 7:52 pm Post subject: (No subject) |
|
|
thx, this solves the problems for a lot of my programs
something i should watch out for, but im thinking that it might be faster to use hotkeys instead of buttons because i dont need to move my hand around. |
|
|
|
|
|
|
|