Ri: MouseBox Selezione di più immaginiè anche possibile utilizzare le funzioni JSL isShiftKey, isAltKey, isControlKey per gestire la decisione rosso / bianco. Il ciclo per raccogliere la selezione potrebbe essere eseguito sul pulsante di rilascio. Penso che sia "Release", stampare la variabile del pulsante per controllare ... lontano dalla scrivania ...
Ri: MouseBox Selezione di più immaginiGrazie mille per avermi impostato sulla strada giusta.
Ho modificato un po 'il codice in modo che l'utente possa scegliere di selezionare o deselezionare, invece di deselezionare automaticamente tutto.
Quindi suppongo che il prossimo problema, verrà con il monitoraggio della selezione. Vedi il codice qui sotto, sembra funzionare, ma mi sembra imbarazzante.
mb << setclick(
Function( {this, coords, button},
If( button == "Pressed",
{pressedX, pressedY} = coords;
Try(
pressedBox = mb << getchildbox( {pressedX, pressedY} );
pressedBoxColor = pressedBox[2] << GetBackgroundColor;
);
,
{thisX, thisY} = coords;
xstart = Min( thisX, pressedX ) - 5;
xstop = Max( thisX, pressedX ) + 5;
xstep = 10;
ystart = Min( thisY, pressedY ) - 5;
ystop = Max( thisY, pressedY ) + 5;
ystep = 10;
// turn off all previous selections
//for( b=lb<<CHILD>= 2,
If( pressedBoxColor == "Red",
boxes[2] << setbackgroundcolor( "white" ),
boxes[2] << setbackgroundcolor( "red" )
)
);
)
);
)
)
);
selection = J( 1, 200, 0 );
counter = 0;
For( b = lb << child, !Is Empty( b ), b = b << sib,
counter++;
If( (b << getbackgroundcolor) == "Red",
selection[counter] = 1
);
);</CHILD>Ri: MouseBox Selezione di più immagini
You might need to turn off the page translate feature at the top of the page before grabbing this code. The magic is in the last few lines; everything else is setup. At the end, <
If you need more control, the graphbox with picture segments and mousetrap might be an alternative.
New Window( "selection test", mb = MouseBox( lb = Lineup Box( N Col( 10 ) ) ) );
// generate some pictures of various sizes
For( i = 1, i < 200, i++,
rows = Random Uniform( 10, 100 );
cols = Random Uniform( 10, 100 );
ls = (120 - cols) / 2;
rs = 120 - cols - ls;
ts = (120 - rows) / 2;
bs = 120 - rows - ts;
red = J( rows, cols, Random Uniform( 0, 1 ) );
green = J( rows, cols, Random Uniform( 0, 1 ) );
blue = J( rows, cols, Random Uniform( 0, 1 ) );
lb << append(
Border Box( sides( 15 ), Left( ls ), Right( rs ), top( ts ), bottom( bs ), New Image( "rgb", {red, green, blue} ) )
);
);
mb << setclickenable( 1 );
mb << setclick(
Function( {this, coords, button},
If( button == "Pressed",
{pressedX, pressedY} = coords,
{thisX, thisY} = coords;
xstart = Min( thisX, pressedX ) - 5;
xstop = Max( thisX, pressedX ) + 5;
xstep = 10;
ystart = Min( thisY, pressedY ) - 5;
ystop = Max( thisY, pressedY ) + 5;
ystep = 10;
// turn off all previous selections
For( b = lb << child, !Is Empty( b ), b = b << sib,
b << setbackgroundcolor( "white" )
);
// test points in the selection box
For( x = xstart, x <= xstop, x += xstep,
For( y = ystart, y <= ystop, y += ystep,
boxes = mb << getchildbox( {x, y} );
If( N Items( boxes ) >= 2,
boxes[2] << setbackgroundcolor( "red" )
);
)
);
)
)
);
MouseBox Selezione di più immaginiVoglio selezionare più immagini usando un mousebox.
Di seguito è riportato un esempio che ho programmato per mostrare come si può selezionare un'immagine una alla volta. Ma poiché potrebbero esserci potenzialmente centinaia di immagini, voglio che il mio utente sia in grado di selezionare più immagini con una funzione di trascinamento invece di dover fare clic su ognuna. Qualche consiglio?
Names Default To Here( 1 );
//dtFull contains image path information
dtFull = Current Data Table();
path1 = dtFull:LocalPath[20];
path2 = dtFull:LocalPath[21];
path3 = dtFull:LocalPath[22];
path4 = dtFull:LocalPath[23];
img = New Image( path1 );
img2 = New Image( path2 );
img3 = New Image( path3 );
img4 = New Image( path4 );
selected = [0, 0, 0, 0];
New Window( "test",
H List Box(
vlb = V List Box(
mb = MouseBox(
pb = Picture Box( img ),
<<SETCLICKENABLE></SETCLICKENABLE>