REM ************************************************************************ REM * SB V2.0 REM * THIS GROUP OF CODE CALLS IS FOR IMAGE SELECT REM * IT CONTROLS THE IMAGE WINDOW UNDER PROGRAM CONTROL REM * USES EDITMODE AS A GLOBAL VAR TO DETERMINE THE CURRENT EDIT STATE REM * sbWnd AND picWnd ARE POINTERS TO THE SB WINDOW AND THE PICTURE REM * AS WHO IS CURRENT REM * IF THE IMAGE DOES NOT EXISTS THEN REM * DEPENDING ON THE EDITMODE, IT WILL InsertObject or REM * NOTIFY THE USER THERE IS NO IMAGE TO DISPLAY REM * IF THERE ARE ANY FASTER WAYS TO DO THIS, DO NOT HESITATE REM * TO EDUCATE ME. REM * I HOPE THIS HELPS ANYONE WHO IS TRYING TO DO IMAGE CONTROL REM ************************************************************************ SUB Showit() REM ********************************************** REM * this call keeps track of editmode and image select REM * it calls the proper routine determined on what REM * editmode is and if the image is displayed and REM * if the image exists REM ************************************************ IF editmode%% = 0 THEN SET STATUS "Loading Image ... Please wait" IF sbWnd%% = picWnd%% THEN CALL ShowImage() ELSE SHOW REGISTER CLEAR REGISTER "USER.EXE","FindWindow","HJC" picWnd%% = CALL ("GetFocus") IF picWnd%% <> sbWnd%% THEN picWnd%% = CALL ("FindWindow",0,"Visual Realty") END IF REGISTER CLEAR END IF ELSE IF sbWnd%% = picWnd%% THEN IF Image.Property <> "" THEN REQUEST "There is an Image already posted"," Press OK to VIEW",140,bn%% IF bn%% = 1 THEN CALL ShowImage() END IF END IF IF Image.Property = "" THEN CALL UPDATE_OLE() END IF ELSE SHOW REGISTER CLEAR REGISTER "USER.EXE","FindWindow","HJC" picWnd%% = CALL ("GetFocus") IF picWnd%% <> sbWnd%% THEN picWnd%% = CALL ("FindWindow",0,"Visual Realty") END IF REGISTER CLEAR END IF END IF END SUB SUB UPDATE_OLE() REM ******************************************************* REM * This routine sets up the ole update from InsertObject REM * It keeps the object window as current until the window REM * is destroyed by update or close REM * It keeps the user from going back to sb until REM * until window is destroyed REM * it does not effect other windows ontop REM ******************************************************* DIM Buff$ REGISTER CLEAR CALL InsertObject() REGISTER "USER.EXE","FindWindow","HJC" REGISTER "USER.EXE","GetFocus","H" hWnd%% = CALL ("GetFocus") IF hwND%% <> sbWnd%% THEN REGISTER "USER.EXE","GetActiveWindow","HH" oleWnd%% = CALL ("GetActiveWindow",0) REGISTER "USER.EXE","GetWindowText","IHFI" Null%% = CALL ("GetWindowText",hWnd%%,Buff$,80) REGISTER "USER.EXE","SetActiveWindow","IH" WHILE oleWnd%% <> 0 WAIT MOUSE OR ICON OR MENU OR FOR 1 oleWnd%% = CALL ("FindWindow",0,Buff$) hWnd%% = CALL ("GetFocus") IF ((oleWnd%% <> 0) AND (hWnd%% <> oleWnd%%) AND (hWnd%% = sbWnd%%)) THEN REQUEST "You must UPDATE or CLOSE the","LINKED window to continue",139 NNull%% = CALL ("SetActiveWindow",oleWnd%%) IF NNull%% = 0 THEN END WHILE END IF END IF WEND END IF REGISTER CLEAR CALL ShowImage() END SUB SUB ShowImage() SET STATUS "Testing for Image... Please wait" Title$ = STnum.property + " " + street.property IF Image.property = "" THEN REQUEST "No image available for",Title$,139 Showing% = 0 ELSE errorimage%% = 0 SET STATUS "Loading Image... " SHOW Image.PROPERTY REM **************************************************** REM * if there is a problem in the file, it is trapped by REM * error check routine REM **************************************************** IF errorimage%% = 0 THEN SET POSITION FOR "Image"50,70,550,385 REM *************************************************** REM *** Use a DLL call to change the caption bar of the REM *** image window to the name of the key field REM * this block was in part taken from the video demo REM * I added to it to get current focus, determine REM * if the image window is still alive and SetActiveWindow REM * to the image until the user terminates the window REM * !! if the user clicks away from the image back to sb REM * then it resets the focus back to image. It does REM * NOT effect other windows programs ontop. REM * It closes when the image is closed and restores REM * the sb app as a last act REM * !!!!!!!!!!! REM * I have not been able to update the record if the user REM * updates the OLE image. REM *************************************************** REGISTER CLEAR REGISTER "USER.EXE","FindWindow","HJC" REGISTER "USER.EXE","GetFocus","H" picWnd%% = CALL ("FindWindow",0,"Image") IF picWnd%% <> sbWnd%% THEN REGISTER "USER.EXE","SetWindowText","IHC" REGISTER "USER.EXE","SetActiveWindow","IH" Null%% = CALL ("SetWindowText",picWnd%%,Title$) NNull%% = CALL ("SetActiveWindow",picWnd%%) tmp3%% = 0 Buff$ = "" hWnd%% = CALL ("GetFocus") SET STATUS "Image" EVENTCLASS MOUSE OFF EVENTCLASS KEY OFF WHILE hWnd%% <> sbWnd%% WAIT FOR .5 tmp1%% = CALL ("GetFocus") tmp2%% = CALL ("FindWindow",0,Title$) REM************************************************** REM******** is graphic alive but displaying superbase ? REM**************************************************** IF ((tmp1%% = sbWnd%%) AND (tmp2%% <> 0)) THEN REQUEST "You must close the graphic window to continue","",139 NNull%% = CALL ("SetActiveWindow",tmp2%%) END IF IF tmp2%% = 0 THEN hWnd%% = CALL ("GetFocus") END IF WEND picWnd%% = CALL ("GetFocus") IF picWnd%% <> sbWnd%% THEN picWnd%% = CALL ("FindWindow",0,"Visual Realty") END IF EVENTCLASS MOUSE ON EVENTCLASS KEY ON END IF REGISTER CLEAR ELSE REQUEST "There is a problem in the Image file","Use reorganize from the menu",139 END IF END IF END SUB