Populating multiselect OpenDialog with a series of filenames - delphi

I use an OpenDialog with Multiselect enabled to allow more than one jpg file to be displayed on a screen. When the dialog is closed, I iterate through the Files list and create a delimited string of filenames which is stored in a memo field of an Access table.
If the user wants to edit the selection, I want to parse the delimited string value and put the filenames into the OpenDialog and have it displayed in the same way it was when they were first selected, however, the dialog only has one filename in the edit box of the form. When the dialog is closed, only this file is in the files list.
How do I re-populate the Files list? We are using Delphi XE on W7-10.
Also, is it possible to have the list "unsorted"? The files list returns filenames in a sorted order, there is no "sorted" property. I would like to be able to have the user select the files in the order they wish to display them. At the moment, sorting is done in a custom editing form that allows them to be dragged to position. This is written out to the delimited string and written to the table.

Related

FDMemTable Loses FieldDefs information when there is AutoInc Field in Delphi

I am creating a memory table TFDMemTable for a delphi form, and define the fields under FieldDefs. After I am done with the definition of the fields manually, I go to the Fields Editor to add the fields that I just defined.
Everything works perfect until I have an AutoInc type field in my FDMemTable. I am using Delphi 10.3.2 version and I was wondering if I am missing anything or this is a IDE bug.
PS: I have done couple of tests, and I think that if the AutoInc field is not defined as the last field, everything disappears. I am not %100 sure of this case, but pretty much every time I try I loose the fields under FieldDefs.
Here is the steps:
Place a FDMemTable icon
Open FieldDefs window
Create a bunch of fields (string, integer ...)
define the names, types (and sizes for strings)
Open FieldsEditor
Add fields
until here everything works as they should.
Go back to fieldDefs window
create and name a new field with autoinc type
open the fields editor screen and add the last added field.
everything is still good to go as long as there is no more changes in the structure.
Here the weird thing happens if you do the following.
open FieldDefs window
create any field ( lets say integer type )
Go to Fields Editor window to add this last created field.
and you will see that you don't see this new field to add.
when you go back to fieldDefs window to see why it is not showing,
you will see all the previous and last added fields' definitions gone..
In order for me to go around this problem, I open the form in text form and insert the new field right before the last field which is autoinc,
add field editor entry manually in the text form,
and when everything is right, I toggle to form view.

SaveDialog suggested filenames to match extension filter

When my program displays a SaveDialog to save a file I can use the Filter and Filter Index properties to restrict the files displayed to certain extensions. Also, when I set the DefaultExt property then, as the user types a filename, matching files in the folder are displayed as suggestions in a dropdown box and one can be selected with the mouse.
For example if the filter is set to "*.xml" then only filenames matching that extension appear in the the dialog list of files. But if the user type "Test", then you will get a dropdown list of suggestion files like:
TestA.doc
TestB.xml
Test123.pdf
TestX.xml
(if those files are present in the folder)
But I would like the suggestion list to only contain the files that match the filter, such as *.xml. Is that possible? The problem is that users can hit the wrong suggestion and save their file with the wrong extension.
TSaveDialog internally uses the IFileDialog interface of Windows. That interface doesn't offer any way in which to change how to filter files in suggestion dropdown text box of File Name field.
You can :
Implement own dialog from scratch
Use component like DexExpress which is not free
Check result of save dialog after execution of it and validate the user selection file and show proper message to user if the file is not valid

How to create dynamic hyperlink using Field Codes in MS-Word?

I am trying to add a hyperlink to a field code in MS-Word, but I want the same field code to populate as part of a search query in the url. More relevant info below:
For Instance, this field code is linked to a form and will populate with a tracking number pulled from an inventory database «TrackingNumber», but then I want to link this generated tracking number into a url query is as follows:
HYPERLINK "https://www.google.com/searchq=«TrackingNumber»"
Is this even possible? And if so, how should I configure?
By default, if you insert a mailmerge field into a hyperlink field, the hyperlinks will all show the first record’s address as the 'Text to display' text, even though the hyperlinks will actually point to the merged targets.
Here's how you can do get a mailmerge to display your preferred default 'Text to display' text instead:
Disregarding mergefield issues for the moment, insert a hyperlink into the document in the normal way, choosing whatever 'Click Here' text you want in the 'Text to display' box.
Select the inserted hyperlink and press Shift-F9 to expose its field code.
Replace everything in the field between '=' and '"' with your «TrackingNumber» mergefield.
Select the field and press F9 to update the display.
In Word 2007 & later, you can make the display text variable also, by following these additional steps:
Position the cursor anywhere within the display text.
Insert a mergefield pointing to whatever data field you want to use for the display text (this could even be the «TrackingNumber» mergefield).
Delete all of the previous display text either side of your last-inserted mergefield (note that this field will likely have updated already).
Execute the merge.
After merging to a new document, use Ctrl-A, F9 to update all fields. Without this, the mergefield hover text won’t update to the correct targets.
Note 1: The above is only for merged output sent to a new document; it does not work with merges to email or print. For merges to email, see: https://support.microsoft.com/en-us/kb/912679
Note 2: Hyperlink fields modified this way are liable to cease functioning once the merge has been executed. Accordingly, it's best to save mailmerge main document before doing the merge and not re-save it afterwards. If you need to make changes to the mailmerge main document, don't make/save them after doing a merge; make/save them beforehand.

Symfony will not populate a form with large string after bind()

I am having issues trying to override the value of a form field after submission. Currently the form includes a textarea and file upload input, but only one is used. If the user uploads a file it is parsed into text. I want to use the data that is parsed from the file as the value for the textare when the page reloads, rather than what was in the text box (empty). The content can not be determined until after the bind.
What I did was just bind the data again to manually set the value of the textarea after the document was parse. It works great if I hard code a value for the value, however when I use the full contents of the file, nothing is put in the textarea. There isn't some sort of length limit or something that could interfere with the population is there? I have tried short strings and they work fine, but these files are about 4k in length and won't populate in the text area.
Works
$this->form->bind(array('text'=>'1234'), $request->getFiles('profile_generate') );
Does not work, even though the value text is actually being set.
$this->form->bind(array('text'=>$largeString), $request->getFiles('profile_generate') );
FIX:
I suppose whatever function that Symfony uses to populate the fields from the bind() values has a problem with non-standard characters. Unfortunately it does not complain about it or let on to what the issue really is. After cleaning up the data, it worked fine.
$largeString = preg_replace('/[^(\x20-\x7F)\x0A]+/',' ', $largeString);
$this->form->bind(array('text'=>$largeString), $request->getFiles('profile_generate') );

Delphi: Multiple tokens edit component

I'm looking for an enchanced edit component that allow users to input multiple tokens (items) manually separated by some symbol, or to select them from another source.
It's something like "TO" field in outlook or facebook that allow you to input multiple recipients.
Can anyone suggest any solution?
The way we sort of do it is to use an normal button edit box and when the user clicks the button we present a separate form (which can be made to look like a drop down box if you like) with a checklist or listview with checkboxes enabled or similar. The user selects any number of the items then when the form closes we take the list of selected items and present them in the edit as a comma or semi-colon separated list. The edit itself is read-only so all interaction goes through the separate form.
But - I really don't like the whole approach (for our app) as it doesn't look good when you have many selected items and I'm looking to find a better way of showing the selection! I suppose one option is to use a read-only memo with scrollbars to show the items.
TMS has some nice components, one of which is the TCheckListEdit which might be of use.

Resources