Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulate Foxypreviewer's Toolbar

Status
Not open for further replies.

dantheinfoman

Programmer
May 5, 2015
131
US
Hi All,

I've been trying to manipulate foxypreviewer's toolbar all day and I can't get it to budge for customization. I'm trying to add an option to the SAVE toolbar to allow "Save As XLS (Basic)" which would hopefully create an Excel file that loads really really fast. Or an option to Save as TXT or CSV. Something that would make saving huge reports go quicker.

Even if I comment out the whole section from Foxypreviewer.prg that talks about building the toolbar (below) it still is unchanged when I build and reopen the program. This is what makes me think the toolbar is coming from somewhere else secretly and GoFish4.app isn't finding anywhere else the toolbar could be coming from.
Code:
****EVEN IF THE FOLLOWING IS COMMENTED OUT, IT ACTS AS NORMAL?!?!****
IF _goFP.lPrintVisible

			* Save to file item
			IF _goFP.lSaveToFile
				DEFINE BAR 17 ;
					OF (m.cPopup) ;
					PROMPT _goFP.GetLoc("SAVEREPORT") ;
					PICTURE This.IMGBTN_SAVE

				LOCAL lcSaveMenu
				m.lcSaveMenu = SYS(2015)

				DEFINE POPUP (m.lcSaveMenu) SHORTCUT RELATIVE

				IF NOT _goFP.lCompleteMode && Original report
					WAIT WINDOW 'not completemode'
					* If the report is "Searchable", show the submenu
					* Otherwise, allow only to save as image
					IF _goFP._lCanSearch
						ON BAR 17 OF (m.cPopup) ACTIVATE POPUP &lcSaveMenu.
					
						* 2012-08-17 allow omitting the file type icons
						IF _goFP.lShowFileFormatIcons
	
							IF _goFP.lSaveAsImage
								DEFINE BAR 1 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASIMAG") PICTURE "pr_Img.bmp"
								ON SELECTION BAR 1 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(1)
							ENDIF
							IF _goFP.lSaveAsPDF
								DEFINE BAR 2 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASPDF")  PICTURE "pr_Pdf.bmp"
								ON SELECTION BAR 2 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(2)
							ENDIF
							IF _goFP.lSaveAsRTF
								DEFINE BAR 5 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASRTF")  PICTURE "pr_Word.bmp"
								ON SELECTION BAR 5 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(4)
							ENDIF
							IF _goFP.lSaveAsXLS
								DEFINE BAR 6 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASXLS")  PICTURE "pr_Excel.bmp"
								ON SELECTION BAR 6 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(5)
							ENDIF
							IF _goFP.lSaveAsHTML
								DEFINE BAR 3 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASHTML") PICTURE "pr_Html.bmp"
								ON SELECTION BAR 3 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(3)
							ENDIF
							IF _goFP.lSaveAsMHT AND (_goFP.lCompleteMode = .F.)
								DEFINE BAR 4 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASMHT") PICTURE "pr_MHT.bmp"
								ON SELECTION BAR 4 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(8)
							ENDIF
							
						ELSE 
						
							IF _goFP.lSaveAsImage
								DEFINE BAR 1 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASIMAG")
								ON SELECTION BAR 1 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(1)
							ENDIF
							IF _goFP.lSaveAsPDF
								DEFINE BAR 2 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASPDF")
								ON SELECTION BAR 2 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(2)
							ENDIF
							IF _goFP.lSaveAsRTF
								DEFINE BAR 5 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASRTF")
								ON SELECTION BAR 5 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(4)
							ENDIF
							IF _goFP.lSaveAsXLS
								DEFINE BAR 6 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASXLS")
								ON SELECTION BAR 6 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(5)
							ENDIF
							IF _goFP.lSaveAsHTML
								DEFINE BAR 3 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASHTML")
								ON SELECTION BAR 3 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(3)
							ENDIF
							IF _goFP.lSaveAsMHT AND (_goFP.lCompleteMode = .F.)
								DEFINE BAR 4 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASMHT")
								ON SELECTION BAR 4 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(8)
							ENDIF
							
					ENDIF 


					ELSE 
						ON SELECTION BAR 17 OF (m.cPopup) ;
								m.oRef.ExtensionHandler.DoSaveType(1)
					ENDIF 
				ELSE

					ON BAR 17 OF (m.cPopup) ACTIVATE POPUP &lcSaveMenu.

					IF _goFP.lSaveAsImage
						DEFINE BAR 1 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASIMAG") PICTURE "pr_Img.bmp"
						ON SELECTION BAR 1 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(1)
					ENDIF
					IF _goFP.lSaveAsPDF
						DEFINE BAR 2 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASPDF")  PICTURE "pr_Pdf.bmp"
						ON SELECTION BAR 2 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(2)
					ENDIF
					IF _goFP.lSaveAsHTML
						DEFINE BAR 3 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASHTML") PICTURE "pr_Html.bmp"
						ON SELECTION BAR 3 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(3)
					ENDIF

					IF _goFP.lSaveAsMHT AND (_goFP.lCompleteMode = .F.)
						DEFINE BAR 4 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASMHT") PICTURE "pr_MHT.bmp"
						ON SELECTION BAR 4 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(8)
					ENDIF

					IF _goFP.lSaveAsRTF
						DEFINE BAR 5 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASRTF")  PICTURE "pr_Word.bmp"
						ON SELECTION BAR 5 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(4)
					ENDIF
					IF _goFP.lSaveAsXLS
						DEFINE BAR 6 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASXLS")  PICTURE "pr_Excel.bmp"
						ON SELECTION BAR 6 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(5)
					ENDIF

					IF _goFP.lSaveasTXT && Create menu option Save as TXT && 11/08/2010 by mauriciobraga@ig.com.br
						DEFINE BAR 7 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASTXT")  PICTURE "pr_1page.bmp"
						ON SELECTION BAR 7 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(6)
					ENDIF
					**ds test
					DEFINE BAR 8 OF (m.lcSaveMenu) PROMPT _goFP.GetLoc("SAVEASMHT") PICTURE "pr_MHT.bmp"
						ON SELECTION BAR 8 OF (m.lcSaveMenu) m.oRef.ExtensionHandler.DoSaveType(8)
				ENDIF

			ENDIF
Please advise if you know anything about this mystery.

Thanks

Dan
 
Among other things, I see an IF but I don't see an ELSE.

But really, isn't this a question for FoxyPreviewer support?
 
Hi Danfreeman,

FoxyPreviewer site doesn't offer any support. Their last release was in 2012. I suspect author Cesar doesn't have that hotmail account anymore either or was barraded with help requests so doesn't check it.
I'm seeking to improve this tool, but I'm still learning a lot as a noob. I'll keep searching using GoFish4.app until the answers come to me. Thank you for your comments, danfreeman!

Yours,
Dan
 
Dan, after you change code, you know you need to recompile the app AND also replace it wherever it's used? When you use foxypreviewer you use the reportoutput.app.

Since you already put in debug messages and wait windows, you already have successfully done changes, so what's really the problem?

Besides, an option to save data as TXT/CSV is not needing any report, neither with nor without foxypreviewer support. Why would you do a report, if you can select a table, then COPY TO some.txt TYPE CSV? The only reason you might have is memo and other fields, which are stored in fpt files, as these are not copied into the txt file by the COPY TO command.

I already said there is the option to save data as sdf via COPY TO some.txt TYPE SDF in your thread thread184-1753852 and there are other types supported, also CSV. You don't need a report for this, therefore it was never foreseen as report option of foxypreviewer. Reports can have layouts with grouping and header/footer, title and summary band, graphics, lines, rtf or other activex object. All in all that's much structure you can't stuff into CSV, CSV is a pure data format, not a report. And the other way around a report is not a data export, unless you specialise your report layout on simple single line detail bands with just a field list, but then you don't make any use of even standard report capabilities and other bands of the report and you are still limited with paper size. A report is just meant for human readable output to printed documents or document files laid out in a given paper or label format.

If you want to export data to csv and can't use COPY TO because of memo or blob fields, how about using faq184-7770?

Bye, Olaf.
 
What the code does is DEFINE BAR, BARs are part of menus, not of a toolbar. This code builds the menu, not the toolbar.
 
Olaf,

Oh what a fool I've been! Thanks to your last comment and me finally figuring out how to debug this info (I ended up having to move the APP in same directory as pjx per some forums, because it kept saying Source code was unavailable even though I had set path correctly) where I found the area of the toolbar. It is within foxypreviewer.prg:extensionhandler.updatetoolbar. Now that I can debug, I was able to see this code and I will try to manipulate it soon.

Thanks so much all!

Dan
 
Well, I also didn't see the wood for the trees. At first I even wrote this code reacts to the toolbar interactions. Of course it defines what's done at selecting menu items, that's what you specify when you specify menu items and it can look as definitions of toolbar buttons, too. It also took me some time to see that.

Indeed toolbars are just a special type of forms dockable and resizing in a snap to grid way. Toolbars can have more than just the typical buttons and so code defining toolbars can add any controls. And the part adding the save as options is just adding items to a combobox of format choices.

In the version I have mauricio braga already added a SaveAsTxt option and if you give the file name the csv or xl5 or xls extension the ExportListener is used to create that file. And in case of CSV it does nothing more than COPY TO (This.cDestFile) DELIMITED WITH CHARACTER ";"

Again: Why go through a report to make that export? You can do that straightaway instead of using a report.

Bye, Olaf.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top