This should make development pretty easy.
I used the sourcecode of Puppybasic 2.5 and the (inofficial) gins 0.9.1, see:
http://www.puppyos.net/forum/azbb.php?1172392169;4

I also activated again all events, that were disabled by BradChuck.
As gins now is a set of inbuilt C-functions in Puppybasic, it is more responsive than communicating using shell-commands.
So the eventhandling should also work on old computers. Please tell me, if this is correct.

MarkLast edited by MU on Fri 09 Nov 2007, 14:39; edited 6 times in total

This is a really good idea ! So for those who know puppybasic they can now fool with gins when & if the need arises. Great way to keep the community on a single track._________________Heaven is on the way, until then let's get the truth out!

Does this work with stuff like the file-select dialogs? I was trying to use gins through Bash a couple weeks ago, but I couldn't make the file-select work and had to call it quits for a while._________________Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Yes, Glade has a widget FileChooserbutton.
You drag it on your Windowlayout, and if you run the program, a fileselection opens, if you click on that button.

BUT: the chosen file is no "attribute" that gins could handle.
This will NOT work:
thefile = gins_get("filechooserbutton1" , "filename" , "<str>")

Instead, the filename must be found out with a native Gtk-function.
(
this helped me:
http://lists.ximian.com/pipermail/glade-users/2006-June/002989.html
https://stage.maemo.org/svn/maemo/projects/haf/trunk/gtk+/ChangeLog.gtk-async-file-chooser
)

A programmer certainly will encounter such a problem more often, so I decided to write a function:
gins_gtkwidgetfunction( widgetname , Gtkfunction )

This currently just supports 2 Gtk-functions:
"gtk_file_chooser_get_current_folder"
"gtk_file_chooser_get_filename"

But my C-code is pretty simple, and could quickly be enhanced on request:
(from gins.c):

It calls gtk_label_set_selectable with the value 1, so activates the textselection of a label.
a will be "Nothing", as that function returns no value (returnvalue is "void", which means nothing is returned).
You also could leave away "a=" here, I just use it to show the general usage.
http://developer.gnome.org/doc/API/2.0/gtk/GtkLabel.html

It can be tested with
./testgtkfunctions.pb

After you click on the button, you can select text of the label.

With the current changes I prepared ginsbasic for the next step (not done yet).
This will be a script, that parses the Gtk-documentation, and generates C functions for gins.c, so that you can access all compatible Gtk functions.

This will cover most functions, only few need special treatment, like those returning arrays. That would follow somewhen later then.

Grrr. Now I don't have an excuse not to get back to work _________________Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

I updated the archive, but you can ignore that unless you are a C-coder who is curious about what will/might come.
Just unfinished teststuff.
Details:
http://wxbasic.sourceforge.net/phpBB2/viewtopic.php?p=5250#5250

More updates.
Imported more functions to manage windows, entry and Textview.

The Textview was a real problem, and is not solved finally yet.
But for simple things it can be used already.

The problem is, that Puppybasic cannot pass back GObjects.
Puppybasic uses as every Basic automatic type-conversion, so you don't need to care about int or char or other difficult things.
The disadvantage is, that it is not easy to add new types like Gobjects to the interpreter (not for me at least).

The Textview uses a GtkTextBuffer and GtkTextIterators to handle things like selecting text, so as I cannot handle them directly, I had to add some wrappers, that use some "fixed" Objects. This still can be enhanced.
But keep in mind, ginsbasic is not indended to replace Perl or Java.
If you want to write a full-featured texteditor like Geany, you need those languages or C/C++ or similar.

But for small tools, the included testprograms will provide you with examples you can use and enhance in own projects.

That's it for this weekend, during the week at work I have no time to continue (except if you request something specific).

I'll attach a picture (the "red" is made by parsing one of Barrys Themefiles )

I also add the current functionlist.
Again, some of themmight crash or simply not work, as type-conversion is not checked in detail.

Time to sleep soon, after around 26 hours of programming without sleep

Mark

Picture:

Functions (324):

Note that the "ginswrap" values can be anything like "dummy", as ginsbasic will ignore them, and use "fixed" internal objects instead.
This list is generated automatically by my scripts.
"gint" and gfloat are numbers (like "215"), gchar are strings (like "abc").
gboolean is "0" or "1".
The list just shows that, to make it easier to see, if a number or string is expected, ginsbasic internally handles them all as "variant", a type that represents them all.

***removed, outdated***Last edited by MU on Fri 18 May 2007, 20:54; edited 1 time in total

can you clarify a point? are all the functions you've listed (intended to be) directly accessable from the gins-basic script?, or are these things that you are adding into gins?

I had a look into gins, and it seems nice but overly simplified, I doesn't appear to have add/remove components on the fly. If it had these two simple commands added it would be a lot more fun and hugely more flexible for the slightly more dynamic gui-application.

Gins will determine the Gtkobject from that name, and then we can run a native Gtk API-call (gtk_window_resize) on that object.
This trick is the "glue" between Puppybasic and Gtkobjects.
This is the relevant part from the C-code:

So in a real object orientated language, you can create + modify.
In ginsbasic, you load + modify.

This is no problem, as long as you use simple widgets like the calculator or a wizard.
But if you wanted to create your own IDE, you would reach limitations, as you could not create your own, "abstract" objects, like textiterators.

Another limit currently is, that the functions can only pass int , char, float.
But not GtkObject.
You can do (simplified code):

("gtk_move" , "window1" , x , y)

But not:
("gtk_add_child" , window1 , button1)
Because Button1 is an object.

You can show or hide elements.
This to a certain degree allows to build "dynamical" applications, but I think for larger projects it would not be sufficient.

Conclusion:
ginsbasic allows to quickly build applications with a GUI-designer.
And you can access each widget in it to a certain degree.
This makes ginsbasic easier to use and more flexible like for example Xdialog or Gtkdialog (the old one, I think the new one supports Glade, too).

So it is perfect for people who felt limitations in those old tools, but don't want to learn more complex approaches like GtkPerl.

MarkLast edited by MU on Sun 13 May 2007, 18:37; edited 1 time in total

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum