clickable image
Posted: Sat Sep 24, 2016 3:34 pm
Hello,
I have a window with 4 tabs. On tab 3 I want to show 1 to 10 images (depending on how much images I have) and when I click on that image I want to show it in a new window on real size. I have looked in the examples, but not all of them are working correctly. The example testsimage gives errors while compiling.
For now I use the ON WINDOW CLICK command, but when tab 4 is active I get to see the result of tab 3. Is there a function that I can check which tab is active/shown, or is there a way to make the image clickable.
Also I want to determine the size of the image to show in the new window, so I can make the window as big as the image. How can I find the sizes of the image?
I have a window with 4 tabs. On tab 3 I want to show 1 to 10 images (depending on how much images I have) and when I click on that image I want to show it in a new window on real size. I have looked in the examples, but not all of them are working correctly. The example testsimage gives errors while compiling.
For now I use the ON WINDOW CLICK command, but when tab 4 is active I get to see the result of tab 3. Is there a function that I can check which tab is active/shown, or is there a way to make the image clickable.
Also I want to determine the size of the image to show in the new window, so I can make the window as big as the image. How can I find the sizes of the image?
Code: Select all
DEFINE DIALOG oDlg TITLE "Detailscherm" + STR(nPlantnum) ;
FROM 0, 0 TO 500, 720
@ 450, 10 GET oGetNaam VAR cLatijnNaam OF oDlg SIZE 700, 40
oGetNaam:SetFont( "Geneva", 24 )
oGetNaam:SetColor( OwnClrGreen, OwnClrYellow )
@ 40, 10 FOLDER oFld SIZE 700, 400 OF oDlg ;
PAGES "Gegevens", "Kenmerken", "Fotos", "Combinaties" ;
*first tabblad, gegevens
@ 0, 0 BROWSE oBrw1 FIELDS "", "" ;
HEADERS "", "" ;
OF oFld:aControls[ 1 ] SIZE 680, 350
oBrw1:SetArray( aGegevens )
oBrw1:bLine = { | nRow | IF( nRow <= Len( aGegevens ), aGegevens[ nRow ], { "", "" } ) }
oBrw1:SetColWidth( 1, 150 )
oBrw1:SetColWidth( 2, 500 )
oBrw1:SetColor( OwnClrGreen, OwnClrYellow )
oBrw1:SetFocus()
*second tabblad, kenmerken
@ 0, 0 BROWSE oBrw2 FIELDS "", "" ;
HEADERS "", "" ;
OF oFld:aControls[ 2 ] SIZE 680, 350
oBrw2:SetArray( aKenmerken )
oBrw2:bLine = { | nRow | If( nRow <= Len( aKenmerken ), aKenmerken[ nRow ], { "", "" } ) }
oBrw2:SetColWidth( 1, 150 )
oBrw2:SetColWidth( 2, 500 )
oBrw2:SetColor( OwnClrGreen, OwnClrYellow )
oBrw2:SetFocus()
*third tabblad, foto's
FOR r = 1 TO 3
FOR k = 1 TO 5
cImage := aFotoNaam[nFoto]
IF FILE(cImage)
@ nRow, nColumn IMAGE oImg FILENAME cImage OF oFld:aControls[ 3 ] SIZE 110, 110
ENDIF
nColumn := nColumn + 120
nFoto++
NEXT
nColumn := 10
nRow := nRow - 120
NEXT
*fourth tabblad, combinaties
@ 10, 10 BUTTON "OK" OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED;
ON CLICK RK_FotoGroot( nRow , nCol )[
FUNCTION RK_FotoGroot(nRow, nCol)
*to show a big picture
LOCAL nFoto := 1
LOCAL oWndFoto
LOCAL oFoto
MsgInfo(STR(nTab))
IF nRow < 400 .AND. nRow > 290
IF nCol > 30 .AND. nCol < 140
nFoto := 1
ELSEIF nCol > 150 .AND. nCol < 260
nFoto := 2
ELSEIF nCol > 270 .AND. nCol < 380
nFoto := 3
ELSEIF nCol > 390 .AND. nCol < 500
nFoto := 4
ELSEIF nCol > 510 .AND. nCol < 620
nFoto := 5
ENDIF
ELSEIF nRow < 280 .AND. nrow > 170
IF nCol > 30 .AND. nCol < 140
nFoto := 6
ELSEIF nCol > 150 .AND. nCol < 260
nFoto := 7
ELSEIF nCol > 270 .AND. nCol < 380
nFoto := 8
ELSEIF nCol > 390 .AND. nCol < 500
nFoto := 9
ELSEIF nCol > 510 .AND. nCol < 620
nFoto := 10
ENDIF
ELSEIF nRow < 160 .AND. nRow > 50
IF nCol > 30 .AND. nCol < 140
nFoto := 11
ELSEIF nCol > 150 .AND. nCol < 260
nFoto := 12
ELSEIF nCol > 270 .AND. nCol < 380
nFoto := 13
ELSEIF nCol > 390 .AND. nCol < 500
nFoto := 14
ELSEIF nCol > 510 .AND. nCol < 620
nFoto := 15
ENDIF
ENDIF
IF FILE(aFotoNaam[nFoto])
DEFINE DIALOG oWndFoto TITLE "grote foto" ;
FROM 0, 0 TO 800, 1000
@ 10, 10 IMAGE oFoto FILENAME aFotoNaam[nFoto] OF oWndFoto SIZE 710, 950
ACTIVATE DIALOG oWndFoto
ENDIF
RETURN NIL