Reply to topic

Kexi forms & scripting

User avatar jstaniek
Moderator
Posts
990
Karma
2
OS

Kexi forms & scripting

Sun Nov 24, 2013 9:34 pm
Below a post from by Dave Macmurchie originally published in the bugzilla. I proposed to move the discussion here.
[..] I need to tell you that the crash occurred on
Day One with Kexi for me, so there is an excellent chance that it results from
ignorance rather than an actual bug. Still I am glad to send you the database
and I will take the liberty of providing a little more background.

I have been making a living as an Access developer for over 15 years and for
the last decade have been looking for an open source replacement for it. I
wasn't impressed with OO Base, and I'm sorry to say that I only became aware of
Kexi in the last few weeks. I wanted to check it out and especially find out
about the scripting situation, since VBA is central to my Access work.

I installed Kexi using the software centre of my Ubuntu 11.10 release and
created a trivial database (attached). I was able to create and populate a
table and create a form as you will see, and then wanted to see if I could
figure out how to capture events. I think that in the course of that I opened
and closed the project a couple of times, but I can't swear to it. In any case,
at some point I had closed my form and on double-clicking it in the Project
Explorer to re-open it, the crash occurred. It took a little while to go
through the bug reporting process since I hadn't yet acquired a Kexi account,
and once that was done I went on to other non-Kexi activities, involving my
bicycle.

Of course I was astonished and delighted to find your replies this morning, and
I have returned to Kexi to send you the database. I have not been able to
reproduce the crash, but I have noticed that when I start Kexi and open the
project, things appear as they should, but if I close the project [Close
Project] and then re-open it [Open] I do not see any objects in the Project
Explorer. If I close Kexi and start again, I am able to open the project as I
expect to using the Existing Projects tab in the Choose Project dialog, which
is not quite the same Open Existing Project dialog that is presented when I
click the Open button after closing the project in the main Kexi window.

While I'm using up your time, perhaps I can ask you for any pointers on getting
started with scripting for Kexi. I understand from the wiki that this is in
early stages, and I've taken a look at an example for importing text data, but
I don't know enough yet about the object model to figure out how to attach code
to events like updates and clicks. I gather that the options for scripting are
Qt or JavaScript, and I'm not very familiar with either, so would you recommend
one over the other?

Once again, many thanks for following up.

Dave Macmurchie
North Cove Technical Services


Best regards,
Jarosław Staniek
• Qt Certified Specialist
KEXI - Open Source Visual DB Apps Builder
• Request a feature or fix for KEXI here
May I help you? Please mention your app's version and OS when asking for help
User avatar jstaniek
Moderator
Posts
990
Karma
2
OS

Re: Kexi forms & scripting

Sun Nov 24, 2013 9:58 pm
Dave,
Regarding the bug, crashes are never user's fault, our policy is zero crashes :)

I tested your database and it doesn't crash here with Kexi 2.7+. There have been a couple of "global" fixes related to memory corruption. This kind of errors could fit to what you observe, especially if that's hard to reproduce. The fixes were backported as usual but not as far back as to 2.3. I recommend newer version of Ubuntu with at Kexi 2.7 or 2.6; newer is better as usual. Basically, Kexi project cannot control how distributions backport kexi to previous editions of their OSes, that's a problem we have to deal with at the moment.

Regarding more general questions, for now there's no support for MSA-style event handling methods. Sure, these are often useful and would finally appear, but the idea is also to minimize the need for going down to the imperative code level, but instead offering rich action/macro system as a primary option. That's from my experience as MSA developer back in 90's.

I see you have put a "Next" button in your form. If you want to know how to program it so it moves to the next record, here it is: you right-click on it, select Assign Action, and select Next Record action. Unfortunately this particular Go To Next Record action is not yet exposed :)

Feedback from MSA users is of top priority, so great to hear something that does not happen every week. What would you see Kexi project can do to improve visibility? I know constantly maintained Windows version would do, unfortunately this would need some sponsorship at least initially.

For example, while having close contact to actual MSA users, scripting could be more carefully designed. From the beginning, scripting is marked as experimental because it's safer - I am aware how important is the backward compatibility for application development environments. Would you have opinion about choice of languages?

Thanks!

PS: Kexi Forum topics related to scripting can be found using this query: http://forum.kde.org/search.php?keywords=script&terms=any&author=&tags=&sv=0&fid[]=220&fid[]=221&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search


Best regards,
Jarosław Staniek
• Qt Certified Specialist
KEXI - Open Source Visual DB Apps Builder
• Request a feature or fix for KEXI here
May I help you? Please mention your app's version and OS when asking for help
pheadley
Registered Member
Posts
1
Karma
0

Re: Kexi forms & scripting

Fri Feb 07, 2014 4:21 am
The statement:

"Regarding more general questions, for now there's no support for MSA-style event handling methods. Sure, these are often useful and would finally appear, but the idea is also to minimize the need for going down to the imperative code level, but instead offering rich action/macro system as a primary option. That's from my experience as MSA developer back in 90's" is the same mistake Microsoft made early on (or they really started with macros and realized the need for VBA) and they are doing it again by trying to get people to use macros. However, this time it's because VBA doesn't port to the SharePoint site so you have to use macros. The truth of the matter is that macros suck because they are way too limited in what they can do. A friend of mine says "VBA fixes everything", and he's right. Scripting allows you to do things that simply cannot be done with macros because macros have to be built for the general cases, like opening a form or report. Some things that scripting allows, or should allow are:
1) The in-process creation and destruction of database and application objects.
2) Performing complicated decission making, such as setting the list portion of a combo box control based on record data or form data.
3) Related to #2, setting captions in forms and reports based on the selected scenario; allowing one to reuse forms and reports for multiple tasks.
4) Automating other applications. With VBA, one can automate Excel, Word, Outlook and other non-microsoft products that present an object model to the developer.
5) Walking users through long, complicated processes, like exporting data sets to a file.

The problem with macros, at least in MS Access are the limitations, such as poor error handling, poor security and the limits to what a macro can do.

If Kexi is going to be the MS Access for Linux, it really needs to become a development enviroment that includes scripting and a fully functional IDE.

I started developing applications in MS Access in 1997 and have made a business out of it. Once I learned VBA, I also learned how bad macros really are and I almost never use macros in projects.

Please seriously consider adding scripting to Kexi in the next release. I don't believe you should tout Kexi as the MS Access for Linux unless it has a scripting development environment. On the other hand, if it does include scripting, I believe it could become the defacto replacement for MS Access.

Patrick
User avatar jstaniek
Moderator
Posts
990
Karma
2
OS

Re: Kexi forms & scripting  Topic is solved

Fri Feb 07, 2014 11:00 am
Hi pheadley,
Thanks for this feedback, I agree here. SImilarly, I remember myself in 1992 or so using macros and quickly dropping their use completely because scripts (modules) were the way to go. That said, macros and scripting have their own user bases. Sure, if we have to choose, scripting has larger user base and thus we would benefit more from scripts.

Advantages of macros are that they are 100% structured; imperative code is by definition based on states and implicit side effects, and has complex means for the control flow, soemthing we professionals use a lot. On the other hand, an idea for macros could be to make them more declarative in nature and richer than in MSA. Looking at QML is somewhat in place: http://en.wikipedia.org/wiki/QML, but I do not mean the notation. Scripting in MSA is poorly structured compared to "professional" programming languages, runtimes, environments.

If we look closer, things are not black/white, macros can reuse object model exposed to scripting and many internal structures. So both words share a lot.

Regarding SDK features, code completion, and other whistles, I can only assure you tools that Kexi use (Qt and KDE libraries) offer many tools to reuse. For what is already working you can look at Qt Creator and KDevelop and the Kate editor.

One action point, once something appears in this document (http://community.kde.org/Kexi/Plugins/S ... ject_Model) you'd be asked for opinions. Well, this way we form one Team as we're developing tools we'd use in increasingly more projects every day! A very important thing for me is relationship with the userbase of MSA power users, that you represent. Let's be in touch :)


Best regards,
Jarosław Staniek
• Qt Certified Specialist
KEXI - Open Source Visual DB Apps Builder
• Request a feature or fix for KEXI here
May I help you? Please mention your app's version and OS when asking for help

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], YaCy [Bot]