Creating a click and drag area selection tool-- Couple probably easy ?s

to_the_sun's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'm working on an aspect of an application of mine, where rectangular sections of a jit.pwindow can be selected by the user and i want a semi-transparent cursory box to appear while the selection is being made, much like when you click and drag in the Max editor itself. This is what i have so far:

I'm using another jit.pwindow as the cursor. Question 1:

-How do you affect the transparency of a matrix? I can't seem to figure it out.

The main problem here is that mousestate reports the absolute position and not the position relative to the patcher window. Question 2:

-How can i get the position of the patcher window so i can make an adjustment? Or how can i get mousestate to report relative positions?

So i suppose question 3 is:

-What do the veterans think of my concept and approach?

Pedro Santos's icon

mousestate mode 1 gives you the relative position you're looking for. See the help file.
Anyway, I don't know if the content of the jit.pwindow is OpenGL or video but, I would do the rectangular selection drawing inside it, not superimpose another pwindow. But if you really want to pursue that approach, why not use [panel] instead? You could use transparency then...

to_the_sun's icon

Thanks for the tips. Yeah I suppose I might as well do it that way, since I'm going to have manipulate the matrix based on the user's selection anyway. I'm working with just static images, no video.