PROGRAM Enable_Hints; {-- *************************************************************************** -- ** Descr. : Script to fix Oracle Bug#900989: hints disabled after conversion -- ** from forms5. The script will run through all itemobjects and -- ** enable the showhints property if there is a hinttext. -- ** -- ** important: -- ** -- ** !**! the showhint property will not be enabled for default !**! -- ** !**! hints. however - defaulthints are language dependant !**! -- ** !**! and might needchanges in this scriptfile! in english !**! -- ** !**! they default to 'Enter Value for : ' ! !**! -- ** -- *************************************************************************** -- ** 28/12/01 1.001.00 Initial Creation, muellers@orcl-toolbox.com -- ***************************************************************************} {*Global Variable Declaration*} VAR v_filename : varchar2; i,j : number; frm : number; hint : varchar2; files : TStringList; itmlist : TStringList; ps : TParamScreen; pb : TParamBoard; {*Main Program Block*} BEGIN //build together a nice parameter screen ... ps := TParamScreen.create; pb := ps.AddBoard('Modules',picModules); pb.addparam(parLabel,'MYLABEL','Script to fix Oracle Bug# 900989: hints disabled after conversion','',''); pb.addparam(parFiles,'SRC','Source Files','','Forms Modules (*.fmb)|*.fmb'); pb.addparam(parPathname,'TRGPATH','Target Path','',''); pb := ps.AddBoard('Options',picOptions); pb.addparam(parCheckbox,'DFLTHINT','Also enable default hints','N',''); //show the parameter screen and wait for inputs if ps.ShowParamScreen('Re-Enable Hints lost during conversion ...') then begin // basic parametercheck ... if ps.Paramvalue('TRGPATH') ='' then raiseException('Missing Target Path!'); files := tstringlist.create; //get the list of fmb-modules to process (with all subdirectories) files.text := ps.ParamValue('SRC'); for j := 0 to files.count-1 do begin v_filename := files.strings[j]; logadd('Changing '+to_char(j+1)+'/'+to_char(files.count)+' '+v_filename); try frm := API_LoadModule(v_filename); itmlist := API_GetAllItemObjects(frm); for i := 0 to itmlist.count-1 do begin if generic_HasProp(itmlist.objects[i],D2FP_AUTO_HINT) then begin if generic_GetBoolProp(itmlist.objects[i],D2FP_AUTO_HINT)=false then begin if generic_HasProp(itmlist.objects[i],D2FP_HINT) then begin hint := Generic_GetTextProp(itmlist.objects[i], D2FP_HINT); if hint<>'' then begin if ps.paramvalue('DFLTHINT') = 'Y' then begin // set it always if so specified ... generic_SetBoolProp(itmlist.objects[i],D2FP_AUTO_HINT,true); logadd(' => enabled '+api_getobjectpath(itmlist.objects[i])); end else begin //set it only if not default hint .. if substr(hint,1,18)<>'Enter Value for : ' then begin generic_SetBoolProp(itmlist.objects[i],D2FP_AUTO_HINT,true); logadd(' => enabled '+api_getobjectpath(itmlist.objects[i])); end; end; end; end; end; end; end; itmlist.free; //now modify the filename to point to the new location and save it v_filename := ps.ParamValue('TRGPATH') +'\'+ extractFilename(v_filename); API_SaveModule(frm,v_filename); //... and finally release the module from memory API_DestroyModule(frm); except // ups! an error happened, so just log it and proceed to the next module logadd(' =>'+GetError,LogError); end; end; end else begin //user must have pressed cancel on parameterscreen logadd('Canceled on parameterscreen!'); end; // free the parameter screen ps.free; END.