Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • the entry field
  • a file lookup control template (filter: *.txa)
  • a list box (with the queue as its FROM attribute)
Image RemovedImage Added
I declared a parser object in the procedure's data section:
TxaParser           DCL_Clarion_TXAParser

and created a routine, which I called from the Accepted embed for both the TXA file name entry field and the lookup button:

Code Block
LoadTXA                                 ROUTINE
	if TxaParser.Parse(TxaFileName)
		TxaParser.GetEmbedData(DataQ,DataQ.DataQText)
	ELSE
		free(DataQ)
		DataQ.DataQText = TxaParser.Errors.GetLastError()
		add(DataQ)
	END

I also had to add DevRoadmapsClarion.lib to the project. 

On running the app and loading a TXA I saw this:

Image RemovedImage Added

That's not quite as pretty as my initial objective. But it wasn't much work to clean up the code for the DCL_Clarion_TXAParser.GetEmbedData method. I also changed the window font to Segoe and the list box font to Consolas. 

The image below, by the way, shows all the embed code for this application. 

Image RemovedImage Added

Because I'd changed the DCL_Clarion_TXAParser.GetEmbedData method, one of my unit tests failed, the one that verifies the exact data extracted from the TXA. I could fix my test to accommodate these changes, but if I make yet another display change I'm going to break the test again. 

Instead I created a simplified GetRawEmbedData routine that does absolutely no formatting, and I used that for my unit test. I also renamed GetEmbedData to GetFormattedEmbedData for the sake of clarity. 

Next up: Invoice.app!

In Part 1 of this series I said I would be refactoring code in the shipping Invoice.app. That was a long time ago, but it's finally time to dive into that app. Read Part 5.

Download the source

The app is available here: ExtractAndDisplayEmbeds.app

You will also need DevRoadmapsClarion.lib and DevRoadmapsClarion.dll, which you can find on GitHub.

Read more about the DevRoadmaps Clarion Library (DCL)