I want to use drag & drop to add selected files into a database.
I know how this can be done in c#
a DragDrop event and with 1 simple line of code you can get an array of the selected files
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
But how do I this in ABL? How do I define string[] files?
define variable files as .... ?
I found some information about TypeHelper and i think it can be used to perform the cast but i have no clue how to create the variable to hold the selected filenames.
I don't think extent can be used since it's limited.
After finding the .Net Mapping reference (http://communities.progress.com/pcom/docs/DOC-16316) i found the solution
DEFINE VARIABLE objFiles AS "System.String[]" NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.
objFiles = cast(e:Data:GetData(System.Windows.Forms.DataFormats:FileDrop),"System.String[]").
do j = 1 to objFiles:Length:
MESSAGE
objFiles:GetValue(j):ToString()
VIEW-AS ALERT-BOX.
end.
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
But how do I this in ABL? How do I define string[] files?
define variable files as .... ?
You could try
DEF VAR cStrings AS CHARACTER EXTENT .
Or
DEF VAR oStrings as "System.String[]".
Sorry, haven't tested either, but those are the 2 mechanisms I know of. I don't think you can use the C# primitive "string" as opposed to "System.String".
I don't think extent can be used since it's limited.
>
What is limited? The number of extents, or the "extent" functionality?
-- peter
Thanks for the answer.
DEF VAR oStrings as "System.String[]" is the solution i used, we probably posted the reply arround the same time.
With limited i mean that the number of extents is limited
define variable cVar as character extent 3 no-undo.
define variable cVar as character extent no-undo.
(see, that I don't specify the extent size 3) creates an undetermined array, so it's variable size until you assign a size to it.
With limited i mean that the number of extents is limited
define variable cVar as character extent 3 no-undo.
That limitation was lifted in 10.1A (I think).
You can now define a variable with an indeterminate extent:
DEF VAR cChar as CHARACTER EXTENT NO-UNDO.
/* some code to calculate iMax */
iMax = 12.
EXTENT(cChar) = iMax.
/* do things */
You can also define input/output parameters as EXTENT, and it works great.
-- peter