Is there a way in Genero 4gl to create a drag and drop to insert files? - drag-and-drop

In know the method ui.Interface.frontCall to open the Windows-Explorer dialog and select files there, but I found nothing so far about an equivalent drag & drop method.

Have a look at FGLDIR/demo/DragAndDrop/drag_from_desk and also read http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_DragDrop_to_from_external_apps.html

Related

Is it possible to drag & drop between custom VS Code tree views?

The 1.66 (March 2022) release introduces a TreeDragAndDropController API which allows for handling drag & drop events for custom tree views.
However in the docs for the DataTransfer object is says:
Drag and drop controllers that implement {#link TreeDragAndDropController.handleDrag handleDrag} can add additional mime types to the data transfer. These additional mime types will only be included in the handleDrop when the the drag was initiated from an element in the same drag and drop controller.
Does this mean that you cannot drag & drop between custom tree views as they would typically have a custom drag & drop controller per view? Or that you're meant to re-use a drag & drop controller between tree views in order to enable dragging & dropping between views?
I have tried various combinations and been unsuccessful in getting a full drag & drop between two tree views. I do see an error in the console on drop in some situations but that is about it.
It took me a while to figure out how to get drag & drop to work between two different treeviews. For me, the problem was a combination of:
Misunderstanding the purpose / usage of dragMimeTypes.
Misunderstanding the purpose / usage of treeDataTransfer.set().
Using an incorrect naming convention for mime types.
This is probably best described by way of example.
Let's assume we're only going to drag from TreeView_A and we'll only drop onto TreeView_B.
For TreeView_A
dropMimeTypes can be an empty array as we're not expecting to receive any drops.
We don't really need a handleDrop() method, again we're not expecting to receive any drops.
dragMimeTypes needs to include the mime type of the treeview that we're going to drop onto (i.e. TreeView_B). A word of warning here, this MUST be in the format application/vnd.code.tree.<treeidlowercase>. So, for this example it would read something like this:
dragMimeTypes = ['application/vnd.code.tree.treeView_b'];
handleDrag() method needs to set using a mime type of the target treeview (Treeview_B), (remember lowercase!)
public async handleDrag(source: TreeItem[], treeDataTransfer: vscode.DataTransfer, token: vscode.CancellationToken): Promise<void> {
treeDataTransfer.set('application/vnd.code.tree.treeView_b', new vscode.DataTransferItem(source));
}
The lowercase requirement seems more like a suggestion if you read the comments in the underlying code... but no from my experience it seems more like a requirement. Had me stumped for ages!
For TreeView_B
dragMimeTypes can be an empty array as we won't be dragging anything from here.
similarly, we don't really need a handleDrag() method.
dropMimeTypes needs to include the mime type of the treeview that we're going to drop onto (i.e. this treeview, TreeView_B)
dropMimeTypes = ['application/vnd.code.tree.treeView_b'];
the handleDrop() method needs to get the correct mime type (you guessed it, Treeview_B in lowercase). In this method, I just log to console.
public async handleDrop(target: TreeItem | undefined, sources: vscode.DataTransfer): Promise<void> {
const transferItemAppContent = sources.get('application/vnd.code.tree.treeView_b');
if (transferItemAppContent) {
console.log(JSON.stringify(transferItemAppContent));
return;
}
}
I'm still not sure that I've 100% understood how this is supposed to be implemented, but I can tell you that the above method works. Hope it helps.

How to insert a clickable link into a table?

I'm wondering if it's doable to insert a clickable link into a table. I'm acutely aware that one can insert a link which will be clickable in SSMS but that's not what I want to accomplish. I'd like the link to be clickable in application. I've searched the Internet but I've only come across the articles about adding HTML tags to the INSERT statement which enables to open the link in SSMS.
create table #link (a varchar(max))
INSERT into #link
VALUES ('Y'
)
You can insert whatever you want into the database columns. But the action "Open this link on a click event!" is something your application has to do.
To put it even closer: The action "Take this string, paint just the text on the screen, let it look like a hyper link and navigate to the hidden URL on a click!" is something bound to a HTML engine. Pass HTML to any browser and the browser will do all this implicitly. But your database is just a container for data...
I would either use a column typed XML and treat the HTML as XHTML, or - this would be much! better - use two columns and create the link either within a query or - again better - in your application.
Assume a table like this:
DECLARE #TheLinkTable TABLE(ID INT IDENTITY,LinkText NVARCHAR(1000),LinkAddress NVARCHAR(1000));
INSERT INTO #TheLinkTable VALUES('Y','http://www.google.com/');
You can use a query like this
SELECT LinkAddress AS [a/#href]
,LinkText AS [a]
FROM #TheLinkTable
FOR XML PATH('');
And you might read into this answer, if you'd need a HTML-table actually.
But - as said above - I'd just read both values from separated columns and build the clickable link in the application.

Vala Gtk Folder selection

I'm creating a simple GTK+ based application in Vala, which should be able to select a folder and then list the files inside it.
I've been able to select a single file using the Gtk.FileChooserDialog but I haven't found how to select a folder instead of a file.
Is there any way to tell the Gtk.FileChooserDialog that folders can be selected or is there any other widget to select folders?
Set the action property.
filechooser.action = FileChooserAction.SELECT_FOLDER;

How to read from an already existing dropdown list and click on OK button using autohotkey?

ControlGet List,List,,DropDownList, Installer Language,English
Control,Choose,1,ComboBox,DropDown
This is the snippet which I am using to read from the dropdownlist and it is not working. Please tell me what is the right snippet to be use here.
Thanks
I'm not sure what you are trying here. This code is something similar to what you require...
Gui, Add, DDL, %chooseMonth% vMonthSelected,January||February|March|April|May|June|July|August|September|October|November|December
It allows you to select Month from the drop down list and stores the selected value in variable chooseMonth

Alter input of form before it is submitted

I'm creating a multilingual Drupal site and trying to implement a search function, that only displays results in the current language, that the user is viewing the site through.
Using Drupals own searchfunction at /search/node it is possible to select which language to search for through the "Advanced search" options, and it works perfectly. However, I dont want to expose these language selectboxes, I just want it to only search in the current language automatically.
What's the best option to do this?
I have one solution where I create a hook_form_alter function, that sets the #default_value in the language selectboxes to the current language, and then I hide the whole "advanced options" with in css. This doesnt seem very right though.
I think the most clean solution would be to hook into Drupals form-processing process and append ex "language:en" to the input text, but I cannot get this to work.
Does anyone know if it is possible via one of the Drupal form related alter functions, to get a hold of the input text and alter it before drupal does its final processing of it?
To answer your question specifically, while using 'hook_form_alter', you have a referenced variable called '$form_state'. This stores the values in the form, and any change there will be passed further.
Also,
I think setting a default value and hiding the field is a good solution as any, only, if you are hiding it you should do it server side, while altering the form. The same field you are setting the default value to. like this:
$fieldname['#type'] = 'hidden'.