Darwinbots Forum

Code center => Suggestions => Topic started by: Panda on January 13, 2010, 12:54:03 PM

Title: Notify Icon
Post by: Panda on January 13, 2010, 12:54:03 PM
With the notify icon, when you minimise the program to the taskbar, it opens the program when you move the mouse over it, this gets a little annoying after a while. Is the any chance you can change it to double click.

Damn just done it again!!! :@
Title: Notify Icon
Post by: Numsgil on January 13, 2010, 03:05:23 PM
Yeah, it's a pain.  When I added "ninja mode" (that icon that triggers it is a ninja btw) I couldn't figure out how to do a right click menu.  Or even have it pop up after a click.  Something odd to do with how VB6 works.

If I have some time in the next few weeks I'll take a look at it.  It's been bugging me too.
Title: Notify Icon
Post by: Panda on January 13, 2010, 03:21:15 PM
I can do the right click but only in Microsoft Visual Studio 2010, are the files intercompatible or is it just backwards compatiblity or is it neither?

EDIT> I love that ninja
Title: Notify Icon
Post by: Numsgil on January 13, 2010, 04:08:18 PM
VB6 doesn't support that stuff natively, so I have to do raw calls to the Win API, which are always error prone.  If you've ever done C++ WinAPI coding you could take a look at how the VB6 code is doing it and see if you can tweak it to work correctly.  The VB code is here (https://svn2.hosted-projects.com/Numsgil/DarwinbotsVB/trunk/).  Not sure which file to look in though.
Title: Notify Icon
Post by: Panda on January 13, 2010, 04:53:54 PM
I have a version of VB6 somewhere, I'll have to dig it out. I'll get back to you later.
Title: Notify Icon
Post by: Numsgil on January 13, 2010, 09:32:21 PM
If you can't find a version there's a download of VB6 on the web site I can point you to.  But it's pretty gimped.
Title: Notify Icon
Post by: Panda on January 14, 2010, 12:31:30 PM
I have found it, it is just whether or not the CD will work.
Title: Notify Icon
Post by: Panda on January 14, 2010, 12:54:58 PM
Any idea which one it is? or... will I have to find it myself?

EDIT>Will you want a right click menu or shall I just create it so you can click on it?
Title: Notify Icon
Post by: Numsgil on January 14, 2010, 06:49:03 PM
If you can figure out a right click menu than great. If not, them single click is fine.  Let me know if you get it working and tested, and I'll give you write access to the repository.
Title: Notify Icon
Post by: Panda on January 16, 2010, 03:19:52 AM
What will people rather for now, single or double click to get darwinbots to appear from stealth mode?

EDIT: That means it is working and atm it is doubleclick but I can change it to any one you want.
Title: Notify Icon
Post by: Panda on January 16, 2010, 04:30:07 PM
Just found out that it doesnt work when you build it into an .exe but works fine during debug.
Title: Notify Icon
Post by: Numsgil on January 16, 2010, 05:03:02 PM
That's weird.  I don't have any brilliant ideas unfortunately.
Title: Notify Icon
Post by: bacillus on January 16, 2010, 05:07:24 PM
Quote from: Panda
Just found out that it doesnt work when you build it into an .exe but works fine during debug.
Sounds like threading issues, although even that sounds dubious (is graphics and logic handled in separate threads?). Sometimes all is needed is a tiny time offset and things that refused to work for inexplicable circumstances magically do. The debug scenario is usually a big clue when going step-by-step.
Title: Notify Icon
Post by: Panda on January 16, 2010, 05:08:20 PM
I have worked out why it is
Code: [Select]
Private Sub OwnerForm_MouseMove(button As Integer, Shift As Integer, X As Single, Y As Single)
    Static rec As Boolean, MSG As Long
    
    MSG = X / Screen.TwipsPerPixelX
    Debug.Print ("WM_LBUTTONUP:" & WM_LBUTTONUP)
    Debug.Print ("MSG:" & MSG)
    Debug.Print ("X:" & X)
    Debug.Print ("Screen.TwipsPerPixelX:" & Screen.TwipsPerPixelX)
    
    If rec = False Then
        rec = True
        Select Case MSG
            Case WM_LBUTTONDBLCLK:
                'RaiseEvent MouseDown(1)
            Case WM_LBUTTONUP:
                RaiseEvent MouseDown(1)
            Case WM_RBUTTONDBLCLK:
                'RaiseEvent MouseDown(1)
            Case WM_RBUTTONUP:
                'RaiseEvent MouseDown(1)

        End Select
        rec = False
    End If

The "X" changes at different points to different numbers, I am not sure if it changes to the same every single time.

EDIT: Dunno how to fix it though. Bacillus, you where saying something about the threading. I have no idea about the treads. The "X" changes when you start a new simulation both inside and outside the debug and the numbers created are different to eachother everysingle time inside the debug, outside the debug they are the same as eachother, but different from inside the debug.
Title: Notify Icon
Post by: bacillus on January 16, 2010, 05:43:19 PM
I'm not sure I understand the connection between mouse events and screen resolution though, and this language (VB?) is uncharted territory for me...
Title: Notify Icon
Post by: Panda on January 16, 2010, 05:45:46 PM
That is to detect whether the mouse is in the right place or not.
Title: Notify Icon
Post by: bacillus on January 16, 2010, 05:55:26 PM
On further inspection, it looks like the rec block might be a good idea to put around the whole method (I assume that this is what prevents the code being exectued multiple times in the same timeframe. Could hint at threading issues...)

What are the triggers of this method? It looks like it triggers on the mouse moving, when it should be on the mouse being clicked.
Title: Notify Icon
Post by: Panda on January 16, 2010, 05:59:43 PM
That is just the name of the sub, that doesn't effect the triggers, it was what it was called originly
Title: Notify Icon
Post by: bacillus on January 16, 2010, 06:02:45 PM
Okay, I'm still in the dark about the role MSG plays. Is it there for debug purposes or does it play another role?
Title: Notify Icon
Post by: Panda on January 16, 2010, 06:06:10 PM
MSG is the part where the information about the mouse is stored, then that is checked against the different constants about the different states of the mouse.
Title: Notify Icon
Post by: bacillus on January 16, 2010, 06:10:26 PM
I see. That leaves button unreferenced, and the name would imply that it carries some information regarding the button clicked...
Title: Notify Icon
Post by: Panda on January 16, 2010, 06:18:48 PM
It is still something to do with the "X" value changing incorectly.
Title: Notify Icon
Post by: bacillus on January 16, 2010, 06:45:34 PM
What is the range of expected and actual values?
Title: Notify Icon
Post by: Panda on January 16, 2010, 06:57:07 PM
From MSG: I am expecting 514 which is what I get without the simulation running, but when the simulation is running I get 428.
From X: I am expecting 7680 which, again, is what I get without the simulation running but, again, I get the different result of 6432.602.

Outside VB6, running it normally, I dont know what the results are, I just know that they change
Title: Notify Icon
Post by: bacillus on January 16, 2010, 07:06:50 PM
A pure guess, but could it be that the 'actual' simulation size somehow changes the perceived values?
Title: Notify Icon
Post by: Panda on January 16, 2010, 07:08:50 PM
I was thinking that, I might check that now.
Title: Notify Icon
Post by: bacillus on January 16, 2010, 07:12:22 PM
Could you post the X-calculation code, or is that black-boxed?
Title: Notify Icon
Post by: Panda on January 16, 2010, 07:14:41 PM
We have a winner, it does it according to the size of the feild, now I need to find a way around this
Title: Notify Icon
Post by: bacillus on January 16, 2010, 07:30:51 PM
Is there a way to reference the window/desktop size instead of the sim? It could also be an accidental reference...
Title: Notify Icon
Post by: Panda on January 16, 2010, 07:39:01 PM
Thats exactly what I am thinking, I need to find a way then to reference the desktop or find out a way to... I have no idea.
Title: Notify Icon
Post by: Panda on January 16, 2010, 07:53:12 PM
At least we have found the problem, I will tackle it tomorrow, got 6 hours sleep last night, maybe a bit less, and I have been up for 19 hours now and I have been half of the day. Maybe Numsgil will have an idea of what we can do now we have identified the problem. Bye.
Title: Notify Icon
Post by: Numsgil on January 16, 2010, 10:45:47 PM
Glad you figured it out.  I don't mind windows programming so much, but getting it to work from VB6 is a huge pain.  So I feel for you
Title: Notify Icon
Post by: Panda on January 17, 2010, 05:32:05 AM
Have you got any ideas that I can do for it then numsgil?
Title: Notify Icon
Post by: Panda on January 17, 2010, 05:53:53 AM
Im just going to test for the value of MSG when it is clicking for every single sim size, thats all I can think of at the moment.
Title: Notify Icon
Post by: Panda on January 17, 2010, 06:21:42 AM
I have done it, will somebody just quickly test it on their computer, prefer numsgil or bacillus
Title: Notify Icon
Post by: Panda on January 17, 2010, 07:12:11 AM
I am now developing a right click menu for it, it only opens up DarwinBots does anybody want it to do anything else

EDIT: Would anybody like stop and play on the right click menu?

EDIT2: I do not have the time at the moment to sort a rightclick menu out, I will get it done, I have got a basic one working, for the time being but it is not enough to put into DarwinBots.
Title: Notify Icon
Post by: Numsgil on January 17, 2010, 03:27:07 PM
Sure, we can test it.  Upload the exe and I'll give it a try.
Title: Notify Icon
Post by: Panda on January 17, 2010, 03:52:54 PM
Here it is, hope it works
Title: Notify Icon
Post by: bacillus on January 17, 2010, 03:59:27 PM
Hooray, it works!
But now I can't delete the stuff it put in my downloads folder.  

"Write a wise saying and your name will live forever."
 - Anonymous
Title: Notify Icon
Post by: Panda on January 17, 2010, 04:02:10 PM
Mnnnnn, is that my fault, anyway, if I have acidently edited any other part of the program I am only uploading the "TrayIcon.cls"(I think thats what it is called) to the SVN thingy so...
Title: Notify Icon
Post by: Numsgil on January 17, 2010, 10:19:45 PM
Seems to work just fine on my machine.  PM me an email address and I'll set you up with privileges to submit changes to the SVN.
Title: Notify Icon
Post by: jknilinux on January 18, 2010, 12:15:40 AM
will this be 2.44.05?
Title: Notify Icon
Post by: Numsgil on January 18, 2010, 02:43:03 AM
Probably.  I don't have any other fixes in the pipeline.
Title: Notify Icon
Post by: Panda on January 18, 2010, 05:52:19 PM
I think that is the end of this one, any chance of moving this to "Dead end and solved suggestions" might not be the right name that, not sure
Title: Notify Icon
Post by: Numsgil on January 18, 2010, 07:02:56 PM
I'll wait to move it till we release I think.  But yeah.