This message contains graphics. If you do not see the graphics: Graphic Version.
Dropping Files From Windows Explorer, Brazilian Resources

Brazilian Resources

Often our customers wish to develop applications in languages which are not directly supported by TX Text Control.

To facilitate such development, TX Text Control can be used with external resource files. These resource files contain information strings, error messages and built-in dialog boxes.

Sometimes customers send us their resource files so that we may pass them on to other developers. This week we would like to present the Brazilian version.

To use this Brazilian resource file in Visual Basic, the following property must be set:

TXTextControl1.ResourceFile = ..\TX Text Control\Bin\tx_res55.dll

Please note that that setting the ResourceFile property of a Text Control does not automatically set the appropriate properties of a connected Button Bar or Status Bar to the same values. These properties must be changed independently.

It is important that resource library for each language has a unique name, as they must be placed in the same directory as the application's executable file.

If you have created a resource file that you would like to contribute to other TX Text Control users, we would be very happy to hear from you.

Top TX Tip: Dropping Files From Windows Explorer

Drag & Drop is an often-used feature in windows environments. Dragging a file from the Explorer window and dropping it into Word is the easiest way to load a document. Here is how you can do that with TX, too.

It's bit harder to do than other Tips and Tricks we presented. That's because you must intercept a Windows message that the Explorer sends to the TX window. This process is called sub-classing.

The source code shows you how it works, but if you don't understand the whole thing it is strongly advised not to alter the code!

Furthermore, if sub-classing is active and the program causes an error or something similar then VB likes to crash. So save your code often. The actual drop handling happens in the following handler:

Private Sub OnDropFiles(Files() As String, Count As Integer, X As Long, Y As Long) Dim iFileType As Integer, i As Integer Form1.TXTextControl1.SelStart = Form1.TXTextControl1.InputPosFromPoint(X,Y) ' If only one file is dropped, the user can choose how to insert the file If Count = 1 Then iFileType = GetFileType(Files(0)) If (iFileType = IMAGE_FILE) Then Form1.TXTextControl1.ObjectInsertAsChar 0, Files(0), -1, 100, 100, 0, 1, 0 ElseIf (iFileType <> 0) Then ' Create a PopUp Menu Form1.PopupMenu Form1.mnuPopup, 0, X, Y ' Either append documents or load the document... If (g_CurMenu = 1) Then Form1.TXTextControl1.Load Files(0), 0, iFileType, False ElseIf (g_CurMenu = 2) Then Form1.TXTextControl1.Load Files(0), 0, iFileType, True End If End If Else For i = 0 To Count - 1 iFileType = GetFileType(Files(i)) If (iFileType = IMAGE_FILE) Then Form1.TXTextControl1.ObjectInsertAsChar 0, Files(i),-1, 100, 100, 0, 1, 0 ElseIf (iFileType <> 0) Then Form1.TXTextControl1.Load Files(i), 0, iFileType, True End If Next i End If g_CurMenu = 0 End Sub

It is called when a WM_DROPFILES message is trapped and it capsulates the system calls, so you don't have to bother with these.

The first parameter of the OnDropFiles procedure is an array of strings. It holds the file names of all the files which have been dropped onto the TX. The Count parameter tells how many files were dropped and the X and Y parameters hold the coordinates of the drop event.

The first thing that happens in the handler is that the current input position of the TX window is set to the location were the drop event occured. This can be done using the InputPosFromPoint method.

It is then checked how many files are being dropped. If only one file is dropped we can offer the user the choice to insert the file the file being dropped into the existing text at the current input position or to load the file and replace the current contents of the document. A popup menu is shown to let the user decide.

But before we must determine the type of the file being dropped. This is done by the GetFileType function. It returns 0, if the file type is not known or the TX internal values for different file types. These are 1 for text, 5 for RTF and so on. If an image is dropped, the function returns 10 and not TX's Load function is called but the ObjectInsertAsChar method.

Free Advertising For Your TX Text Control Application

For you long-time TX users, I guess you are getting fed up of reading about this, but as there are more than 1400 new TX Text Control Newsletters readers per month, I do have to repeat this about once a month. Please do not despair!

So, to all you new to TX Text Control: We would like to give you the opportunity of free advertising for your TX Text Control based product on our web site.

All we ask is that you send us your text, as well as a few screenshots detailing how you used TX Text Control in your software application and within about two days of receiving this material, we will add your story, along with your logo and your name to our sample application pages:

So far we have had a terrific response to our request for sample TX Text Control applications from the hard core TX users, but I am know there are thousands of other TX based applications out there - all of which should be added to the sample application page. Just send me a short text, explaining how you used TX Text Control to implement your application and you get free advertising for this product on our web site. I'm looking forward to receiving your material!

VBUG Promotion: Transition to .NET

One of the most efficient and cost-effective ways to keep up with the latest Windows development technology is to become a member of VBUG. As a member you'll be eligible for FREE technical support, a free monthly magazine, local meetings and conferences and discounted MSDN subscriptions.

To help you prepare for the transition to .NET and whilst stocks last we are giving away a copy of the latest Visual Studio .NET beta software on CD absolutely free to new members.

This is a fantastic opportunity to familiarise yourself with the new technology and prepare for the next major challenge - how to migrate the systems you're currently developing to the .NET platform. Follow the link below to find out more about VBUG and get your free copy of the XML Developer Magazine.

Best regards

The Newsletter Team

Text Control GmbH respects your online time and privacy. We only send this newsletter to TX Text Control customers and people who have signed up to receive it. However, if you would prefer not to receive future issues of the newsletter, you may unsubscribe at any time. If you received this newsletter forwarded from a colleague or friend, you may wish to subscribe directly.

Sent to: N/A.

Imprint | Unsubscribe | Subscribe

© 2020 Text Control GmbH. All Rights Reserved.