Re: Clickable windows areas
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Mar 30, 2002
- 419 views
Evan, I tried Derek's suggestion about making an array of captionless windows, but found that I couldn't make the black keys in their proper positions, "overlaying" portions of the white keys; I tried buttons, too, with same problem. I then tried making a drawing of a piano keyboard, with the intention of saving each key as a separate .bmp, and then pasting them onto the screen so they looked like one keyboard, but as I was doing that it finally dawned on me that it would actually be simpler to just...test against x-y position of mouse!! So my inexpert conclusion is that isn't really a useful easier way than what you were already aware of. Dan Moyer ----- Original Message ----- From: "rudy toews" <rltoews at ilos.net> To: "EUforum" <EUforum at topica.com> Sent: Saturday, March 30, 2002 4:06 AM Subject: RE: Clickable windows areas > > > Evan Marshall wrote: > > Is there an easy(+ or -) way to make certain areas of a window > > clickable? > > I have an image of a piano keyboard and I'd like to be able to make the > > keys clickable. > > I could use an onMouse event and check to see if the mouse was in the > > area of a certain key, but I am hoping there is an easier way. > > > > > hi Evan > i am only beginning to learn the win32lib myself trying to creata a > windows program. if you turn your piano keys into bitmaps that are used > as icons assigned a name when creating buttons then: > you can probably stay away from mouse coordinates(and calculations). > > or > > my first atempt was to create a keypad where all the keys are beside one > another in a rectangle. basexy = [0,x,y] > mouseat returns 3 item sequence, x in position 1, y = position 2 > a keypad that is 13 keys accross by 4 rows up > using the left bottom corner of the rectangle as a base and a common > keyshape then: > > amhere = mouseat() > keyx = int((amhere[1]-base[1]) / 13)+1 > keyy = int((amhere[2]-base[2]) / 4) + 1 > keynum = keyx * keyy > > hope this helps > rudy > lotterywars > > > >