Ecere SDK/eC Forums
http://ecere.com/forums/
Print view

MouseOver and changing a Picture bitmap
http://ecere.com/forums/viewtopic.php?f=5&t=54
Page 1 of 1
Author:  jerome [ Wed Mar 17, 2010 6:16 pm ]
Post subject:  MouseOver and changing a Picture bitmap

This morning nomoon asked on IRC about this. I was lacking sleep and I was under the impression that was indeed broken, but it turned out I was missing a proper path to my mouse over image.

This code works:

Code: Select all

import "ecere"
 
class MouseOverForm : Window
{
   text = "Mouse Over / Picture Test";
   background = activeBorder;
   borderStyle = sizable;
   hasMaximize = true;
   hasMinimize = true;
   hasClose = true;
   size = { 640, 480 };
 
   Picture picture1
   {
      this, image = { "pic1.jpg", transparent = true };
 
      bool OnMouseOver(int x, int y, Modifiers mods)
      {
         Capture();
         image = { "pic2.jpg" };
         return true;
      }
 
      bool OnMouseLeave(Modifiers mods)
      {
         image = { "pic1.jpg" };
         ReleaseCapture();
         return true;
      }
   };
}
 
MouseOverForm form1 {};
Cheers,

Jerome
All times are UTC-05:00 Page 1 of 1