Create interactive GTK interface through Lua - lua

I'm building an application heavily reliant on plugins. These are coded in Lua for easier and faster development.
I now want to add GTK user interfaces for the plugin's configurations. The problem right now is that I need a way to interact with the interface through external code (signals and callbacks basically). And I'm not sure how to implement that behaviour with only an external Lua script.
Is my approach correct or should I instead implement a native solution in my framework for UI?

If you are on linux or BSD, Lua is a perfectly valid choice for GTK. Just take a look to the lua-lgi project. Once installed, you can start building an UI in a matter of seconds:
lgi = require'lgi'
Gtk = lgi.require'Gtk'
dialog = Gtk.MessageDialog { text = 'This is a text message.', buttons = 'CLOSE' }
dialog:show_all()
Gtk.main()
The greatest feature of lgi is that it works for every GObject based library, e.g. cairo, goffice, gnome-db and many more.
If you are on Windows you are out of luck. I have built a working installer but it is more a proof-of-concept than a real project. The road to that has been really tough, expecially because gobject-introspection (widely used by lgi) is not cross-platform friendly yet.
I have no experience on other OS.

Related

Send Commands to Delphi Application with Lua Script

I would like to be able to access TButton TCheckBox TEdit etc.. of a running Delphi application from a Lua script.
It is a retail Delphi application so I have no access to the source code. I would normally use AutoHotKey but would like more control.
Is this possible as I seem to be able to change things with the Enabler below. Could it be done by integrating Lua into a Delphi app and use it to send to the retail Delphi app ?
Or is there another way ?
An open source solution would be best so to make it available to others.
I use Reaper DAW and it has API for Lua scripting I would like to be able to do similar with the Delphi app without the API available.
In order to run any script in a specific application then that specific application needs to have suitable scripting capabilities built into it in order to be able to interpret that script accordingly.
Now I'm guessing that "retail" application you are using doesn't have LUA scripting built into it otherwise you probably wouldn't be here.
So I'm afraid that the answer is no. You can't interact with a third part application from LUA script unless that application is designed to work with LUA scripts.

Is it possible to customize your desktop through the electron framework?

I'm working on a project in which the user will be able to change windows app icons through an application. Is it possible to have electron perform such a task or is it impossible for the electron framework to actually communicate with windows like that?
I sadly can't proof that but
I think it is possible. You could for example use Child Process and spawn processes that do things for you or write your own c/c++ modules. You can actually write c/c++ node functions, classes and so on, wrap them and use them in nodejs. Here to the Reference. Be aware though, if you don't find any pre-made solutions you have to do that for every operating system individual!

Is any possibilities to use ANT UI Design in Electron Desktop App Framework?

I have found so many facility to use javascript, Angular, material design ui with Electron App Framework, I would like to know, is there any possibilities to use ANT UI for my desktop application? At-least some work around.
Yes
The short answer is yes. Electron provides an entire NodeJS environment and allows you to use common Node, Javascript and React toolsets.
In fact, Electron is listed as an officially supported environment on their Github page.
That being said, it's a very diverse library so there might be occurrences where a particular component is not supported or might need tweaking to be compatible with the Electron environment.
Update
The company I work for actually had to do this for a project we're working on so I can officially confirm that it works great.

Clojure iOS Development

Over the past months, I've pretty much fallen in love with Clojure and refuse to use anything else.
I am aware that there is ClojureScript, which uses Google Closure to compile a subset of Clojure to JavaScript.
Is there anything similar in the works for Objective-C/Cocoa?
I would love to be able to prototype applications in Clojure, and then get an iOS app out of it.
[I'm perfectly fine if this prevents me from all the low level details of iOS -- I don't need access to any low level details (say pointer arithmetic) that I can't do in Java -- I just want to be able to easily transform my Clojure Apps onto the iOS]
You can run clojure on iOS by compiling clojure to scheme, https://github.com/takeoutweight/clojure-scheme
There's one more option (warning: haven't tried it yet):
https://github.com/oakes/lein-fruit
This Leiningen plugin translates Java bytecode to native code for iOS. And there's even IDE that has it built-in:
https://github.com/oakes/Nightcode
I've just discovered las3r which is a Clojure port to the ActionScript (the language behind Flash) runtime. Since Flash/ActionScript can now develop for iOS (I'm in the process of writing a game right now. It's not wonderful, but it's quite usable), this may present a path to writing Clojure applications for iOS.
DISCLAIMER: I haven't tried this. I've just barely discovered las3r, haven't even downloaded it. and have no idea if it's good or terrible. I don't know how awful the speed will be. I know nothing.
Still - it's an intriguing idea, isn't it?
There is Re-Natal a simple command-line utility that automates most of the process of setting up a React Native app running on ClojureScript.

Cross-platform development - Delphi 2011: How to made a Windows-tied library cross-platform?

As perhaps you know already, most probably the next version of Delphi will be cross-platform. Also, here are some polls on the matter.
While writing a cross-compiler isn't a thing which interests us very much now, porting a library which was/is Windows-tied to multiple platforms, certainly does.
You can think, for example at VCL (Delphi's standard library). While it was designed for Windows only, it has value in it, and, of course, there are huge codebases which depend on it.
The question is:
Which would be the best approach to made an application / library cross-platform aware ensuring a smooth conversion / upgrade path (as much as possible of course)?
I stress it again, we are not interested which is the best way to do cross-platform development only (there were questions on this theme). We are interested also in yet another requirement: The old code base / installations management.
PS: Experiences and/or methodologies from similar situations with other languages (eg. C/C++) which are regarded as standard practices are welcomed.
Thanks in advance.
Visual component developer's perspective:
Add levels of functionality to your code, so as to be able to add another platform without changing the "Core" of the component.
The compiler hopefully will have a platform switch. (Preferable more than one, working in conjunction with each other. ex. Windows/ARM, Windows/386, OSX/Cacao/386, Linux/Gnome/386).
The Layout structure might look something like this.
ComponentJ.pas
Linux\ComponentJ.pas
Linux\Gnome\ComponentJ.pas
Linux\KDE\ComponentJ.pas
OSX\ComponentJ.pas
386\ComponentJ.pas
ARM\ComponentJ.pas
As an Application Developer:
I'll start by moving all WIN API calls in my code into a group of libraries in a Windows directory as to be able to IFDEF it at library level and translate it into another platform I'd like to support as soon as the compiler becomes available, but only as I come across them.)
This will also add the possibility to add adapters easier for the new platforms.
It in any case is good practice to remove possible dependencies into a central place.
IMHO you can't build a xplatform Delphi and ensure a smooth transition for current VCL applications. It won't work. VCL was (luckily, because it allowed for great applications) designed with Windows in mind, and trying to design a compatible library working on a different platform would just mean longer development cycles and lots of compromises. The outcome will be a library noone would wish to use. Look at what happened to VCL.NET: it was the wrong choice. And it was working on the same OS!
We know that targeting non-Windows platform with native applications needs a native GUI library. We don't care about creating a GUI from scratch, for our application it's the way to go, we don't need Windows GUIs with all their standards under a different OS using different standards - we need to be able to code a fully native GUI for the target OS.
Other applications may survive a GUI porting, but in the long run you don't get a real xplatform tool - you get a tool that may compile for other platforms but brings one platform paradigms to others - and it will also be not welcome by "native" developers on other platforms. If you're a Linux or Mac developer, why should you learn how to work with a library that carries its Windows inheritance to your platform? You'd find it a pain in the ass. If Embarcadero wants to sell XDelphi outside actual developers base, it has to offer much more than a new CLX.
I will pull from some ancient experience in making a code base cross compilable between windows and dos (Delphi 1/Turbo Pascal 7). The rule of thumb was to separate code into multiple units. Try to code WITHOUT using windows, messages or any visual components. If you find you need to make a call to one of these, then place that call in another unit and write a proxy (abstract class that you descend from works well) to dispatch the calls through. When a cross compatible version is released, all that you should have to do is code the other side of the proxy for the new target.
If you're designing a form based system, then try to stick with as many of the standard components as possible. NEVER implement any "business" rules directly in an event, instead place them in another unit and call into the other unit to perform the logic.
Now, there will definitely be changes required to get your final project cross compatible, but by following these simple patterns you should be able to greatly reduce the amount of work it will take.
Experience so far has shown that the best way to get a Delphi app compatible with future versions is to stick to pure Delphi components, and use nothing third party. Such an app will probably suck, but that's how it seems to me. I use lots of third party components, and the apps are great and successful. But the chances of them moving to this future too are not certain, and that may cause problems with such changes, but I'd rather have a great app now and have the problem than have a poor app now and not need to worry about it.
Compromises should not be done too much to make VCL compatible with Linux and Mac. Windows is VCL's root. I'll prefer a new and very clean GUI framework, even though without any backward compatibility. Make VCL fatter and fatter isn't a good idea!
make a cross-platform Pascal compiler
make a cross-platform RTL
put the QT on top
Well, look at freepascal and lazarus
I don't get it. All .NET looks the same to me providing we don't use any third party.
Delphi using standard control is already fully functional but your app would look
like thousands of others.
I think Embar should go for PDA, IPhone, Andriod as Windows desktop already eat about
98% of the market.
Mac is expensive and Linux is no cost at all. No use to go for Mac and Linux. Not worth
the investment.
Well, aside the things said - thanks all - I do think that there we need some additional things:
we need tooling to do the necessary conversions
we need tooling to help us in programming against a (some form of) MVC pattern
Simply pick the latest 4.6 QT and add good integration betwen the Pascal and the QT library.
They have done it before (in the Kylix times). The QT is such powerfull these days.
I believe that QT is even better then VCL and at least 10 times more frequently updated and fixed.
So the plan is simple:
make a cross-platform Pascal compiler
make a cross-platform RTL
put the QT on top
and you will have a first-class natively looking applications on all platforms.
My opinion:
Make cross platform compiler (OS x/Linux/ embedded solutions?/ symbian?). Maybe add ability to compile/convert pascal code into portable c/c++ code to build then on embedded platforms.
RTL have to be separated into cross-platform layer and native layer (as for JCL).
Add new core components for cross-platform compatibility and native components for each supported platform (QT for ex)
Add translation utilities to create/convert between platform's components, for ex: to convert pure windows form into mac os x cocoa's form.
All windows hierarchy of components have to be only upgraded to support x64 with maximum backward compatibility. All cross-platform component have to be in parallel hierarchy.
Next version of cross platform solution can be refactored and can include migration/convertion utility. Due to minimum codebase of cross-platform solutions, hierarchy and classes for cross platform can be heavily changed from version to version to achieve best architecture.
sorry for my English - not a native language (Russian is)!
Make C/C++/Delphi compilers that targets OSX/Linux
Make C/C++ compiler that can be Boosted
Write new VCL-Presentation Foundation (VGScene/WPF alike)
it should not be backward compatibile! Delphi IDE should be
written with such VCL-PF
Component Library should stay as it is (but with improved Data-Binding)
Only provide VCL 64-bit for Win64
Is this a problem?

Resources