r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Red] Red language group

Dockimbel
7-Sep-2011
[3214]
Need to go to sleep now, will look into that tomorrow morning.
Oldes
8-Sep-2011
[3215x2]
just testing for a while... having:
	MagickGetImageWidth: "MagickGetImageWidth" [
		;{Returns the image width.}
		*wand     [wand!]
		return:  [integer!]
	]

When I do:
	width: MagickGetImageWidth *wand
	print ["image width: " width " " MagickGetImageWidth *wand]
I get:
	image width: 78 0000004E
I was expection:
	image width: 78 78
What do you think?
(but that's a detail... I'm still waiting for the decimal support)
Dockimbel
8-Sep-2011
[3217x3]
Curious bug, I will look into it.
BTW, you can use PRINT-WIDE instead to insert white spaces automatically.
Oldes: I can't reproduce the issue, I tried with the following test 
code:

	#import [
		"msvcrt.dll" cdecl [
			abs: "abs" [
				n 	[integer!]
				return: [integer!]
			]
		]
	]

	width: abs -78
	print ["image width: " width " " abs -78]

I get:
    image width: 78 78
Oldes
8-Sep-2011
[3220x2]
You are right, the main difference is, that I was using stdcall while 
you are using cdecl, which works as expected.
What is reqired to do to add the decimal support? Also i64 would 
be needed to fully suport multimedia libs.
Dockimbel
8-Sep-2011
[3222x4]
A lot of work. :)
It would mainly need a full backend code generator for supporting 
floating numbers. It would also require to add some runtime conversion 
with other numerical types and probably many small additions at all 
stages of compilation.
I guess it would take, at least, a full week of work to support floats 
fully.
I would be glad to work on it, but there are just too many other 
higher priority tasks currently. I won't be able to start working 
on it before October.
Kaj
8-Sep-2011
[3226]
http://www.osnews.com/comments/25143
jocko
9-Sep-2011
[3227]
Tested GTK examples under windows XP, after installation of the GTK2+ 
run time (8 MB, ... the price of portability, sigh ...)
Nice work, Kaj
Kaj
9-Sep-2011
[3228x2]
Cool, I was wondering if it worked on Windows already
I did download the Windows GTK distribution to get the library names 
right, so apparently I did it right :-)
Dockimbel
9-Sep-2011
[3230]
Good work Kaj, I tested the GTK binding examples also on Windows 
7 and it works flawlessly.
Kaj
9-Sep-2011
[3231]
That's odd, because the binding is still broken at the moment :-)
jocko
9-Sep-2011
[3232]
why do you say that the binding is broken ? It was ok this morning.
Kaj
9-Sep-2011
[3233x2]
With the Hello World examples? Slightly more complex examples don't 
currently work due to new Red bugs
Hopefully we're now dealing with the last one
jocko
9-Sep-2011
[3235]
Yes, it is ok on the example codes. On this one, only the first widget 
is displayed
gtk-begin
gtk-view window [
	"Hello World"
	label "Hello, Red/System GTK+ world!"
	button "ok"
]
Kaj
9-Sep-2011
[3236x2]
Right, there are bugs in detecting object/struct/widget types
It prints warnings when you start from a command prompt
jocko
9-Sep-2011
[3238]
ok, I see
Kaj
9-Sep-2011
[3239]
The GUI constructors are written to be flexible, so rather than crash, 
they work as best as they can while issuing warnings when they encounter 
errors
jocko
9-Sep-2011
[3240]
good strategy
Kaj
9-Sep-2011
[3241]
Thanks. It makes them backward and forward compatible to some extent
Dockimbel
9-Sep-2011
[3242]
Bug should now be fixed.
Kaj
9-Sep-2011
[3243]
Not for me
Dockimbel
9-Sep-2011
[3244]
I have tested with your code example and GTK debug version. I'm getting:

type: 1005
value: 0
Window: skipping missing widget.
Kaj
9-Sep-2011
[3245]
I'm still getting 1000
Dockimbel
9-Sep-2011
[3246]
I do a quick test on Linux, just in case...
Kaj
9-Sep-2011
[3247]
missing widget

 in itself is already a bug. If it would recognise it as system/alias/gdk-image! 
 it would say "missing icon"
Dockimbel
9-Sep-2011
[3248]
Ok, looking on that.
Kaj
9-Sep-2011
[3249]
In my test program, gdk-image! is alias 1018, so 1005 seems way off
Dockimbel
9-Sep-2011
[3250x2]
Yes, I have located the issue in compiler code, I am now looking 
for a durable fix.
Pushed a temporary new fix for #172, let me know if it works for 
you now.
Kaj
9-Sep-2011
[3252x8]
Yes, thanks!
I've moved the GTK library initialisation into the binding, so that 
the explicit gtk-begin isn't necessary anymore; but it prevents using 
the workaround still needed for #129
I suppose local variables are not initialised?
Implemented attaching an object to a (button) action
Here's an example that gets input from a line entry field:
Red/System [ ]

#include %GTK.reds

button-pushed: function [
	[callback]
	widget				[gtk-widget!]
	data				[handle!]
][

 print ["Input: "  gtk-get-entry-text  as gtk-entry! data  newline]
]

input: field "Here"

gtk-view window [
	170 90  gtk-position-center
	"Red GTK+ Input Field"
	fixed [
		70 10  label "Input:"
		 5 30  input
		60 60  button [50 25  "OK"  :button-pushed input]
	]
]
Added a few more examples
Doc, the examples are now suitable for demonstrations, such as coming 
week
Dockimbel
10-Sep-2011
[3260]
Nice!
jocko
10-Sep-2011
[3261]
adding some actions could be attractive for a demo
Kaj
10-Sep-2011
[3262x2]
Sure, if you can double my hours in a day
Doc, the 0MQ binding still works, so you can use the request/reply 
example, on Linux or Windows