Author Topic: Claro-AIR  (Read 14087 times)

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #30 on: October 06, 2013, 10:34:14 PM »
Ok, start adding the stuff back in.  Start with the TextArea, then the Buttons (don't forget the buttonarray).

I have a sneaking suspicion, but want to see what happens first.

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #31 on: October 06, 2013, 11:05:06 PM »
Some info regarding layouts:

Quote
    ‘[’ and ‘]’—Starts and ends a “row”. Rows have a default height, but you can put modifiers at the beginning to change it.
    ’|’—Separates cells inside a row. You can put any digits, uppercase, lowercase, or ’.’ chars between them to name cells. Cells don’t have to have names, which is common practice for “spacing” or empty cells.
    ‘<’ or ‘>’—Put anywhere in a cell indicates the cell should take the minimum width.
    ’_’—Put at the beginning of a row (like [_text] above) and that row will take up the remaining “unset” space. Also known as the “flex” operator, you can have as many flexed rows as you want and LEL will make them divide the remaining unset space between them.

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #32 on: October 06, 2013, 11:27:58 PM »
I tried the buttons only first and that cause the exit. The text only version works fine.

Code: [Select]
import claro

var bTop:cint = 16
var text: ptr TTextArea

proc window_closed (obj: ptr TClaroObj, event: ptr TEvent) {.cdecl.} =
  claro_shutdown()

var Form1 = newWindow( nil, new_bounds( 100, 100, 420, 330 ), 2 )
window_set_title( Form1, "Simple Window" )
object_addhandler( Form1, "destroy", window_closed )

text = newTextArea(Form1, new_bounds(bTop,bTop, 300,300), 0)

window_show(Form1)
window_focus(Form1)

claro_loop()

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #33 on: October 07, 2013, 04:39:12 AM »
Ok, I figured it was the buttons. 

Try adding them back in, but don't connect the button proc.


Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #34 on: October 07, 2013, 08:19:23 AM »
Ok, the problem is not the buttons.  There's something weird happening on your end.

I was able to compile it under Win7 with no issues.

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #35 on: October 07, 2013, 10:21:24 AM »
I will give it a try on my Win7 64 partition today. I would like to get Kent to be your Claro Windows guy and I'll do Linux.

This is really great news and a fine project you're saving.

Just read your PM. Thanks!

« Last Edit: October 07, 2013, 10:43:24 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #36 on: October 07, 2013, 11:17:56 AM »


Works great and thanks for the new Windows Nimrod development environment. You should share this with Kent as well.

It is really cool to see focused efforts being turned into something worthwhile.

Is there anyway to get XP themes working?

FYI This forum has a code repository for members of this forum only. This would be a good place to put not ready for prime time code releases.
« Last Edit: October 07, 2013, 01:04:54 PM by John »

kryton9

  • Guest
Re: Claro-AIR
« Reply #37 on: October 07, 2013, 01:15:26 PM »
John, I am trying to join you guys in the linux world.
This really steamed me off at Microsoft:
http://www.zdnet.com/blog/hardware/microsoft-confirms-that-uefi-secure-boot-might-lock-out-linux-and-older-versions-of-windows-from-new-pcs/14942

I have been linux reading. I read an interview(2012) with Linus Torvalds where he mentions he uses Fedora and LXDE. I was going to try that next.

Report of my virtualbox vs vmware player tests:
Now I am running a very weak netbook, but I really like it. The Acer Aspire One 722, with a dual core AMD C60 APU and I maxed out the RAM at 4GB recently.

Both vmplayer and virtualbox are neat. I must say I liked virtualbox just a bit more. At least on my netbook, everything works really well and it does support 3D acceleration.
Just running Debian, it was fine, but when I compiled stuff, I could see how slow it was being in a VM.

I got wine to run and ran an opengl program written in oxgenbasic, amazing that it ran, but at half of acceptable framerates. Which was better than I expected on this netbook with debian running in a virtualbox, running wine, running opengl, pretty cool.

I am going to use virtualbox to choose a distro I like and to learn linux more. Then I will install the chosen Distro as a dual boot on the netbook. So I won't be coding much for a couple of days.


Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #38 on: October 07, 2013, 01:30:32 PM »
It's hard to get Kent dressed in the morning when he insists on running around naked.  :D

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #39 on: October 07, 2013, 01:44:58 PM »
I'm not even gonna ask......

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #40 on: October 07, 2013, 02:16:32 PM »
Actually I admire someone that takes building their development environment seriously. It's like moving into a new house.

I just recompiled tt.nim and it works fine. I'm going to try and do a DLLC interface to Claro with SB.

Code: [Select]
F:\Claro-AIR\nimrod\projects\claro>nimrod c -D:release tt.nim
f:\claro-air\nimrod\config\nimrod.cfg(36, 2) Hint: added path: 'C:\Documents and Settings\John\.babel\pkgs\' [Path]
Hint: used config file 'F:\Claro-AIR\nimrod\config\nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: tt [Processing]
Hint: claro [Processing]
claro.nim(465, 2) Hint: 'noBoundsVar' is declared but not used [XDeclaredButNotUsed]
Hint: strutils [Processing]
Hint: parseutils [Processing]
tt.nim(15, 6) Hint: 'seed' is declared but not used [XDeclaredButNotUsed]
tt.nim(31, 6) Hint: 'val' is declared but not used [XDeclaredButNotUsed]
gcc.exe   -o f:\claro-air\nimrod\projects\claro\tt.exe  f:\claro-air\nimrod\projects\claro\nimcache\pure_parseutils.o f:\clar
o-air\nimrod\projects\claro\nimcache\pure_strutils.o f:\claro-air\nimrod\projects\claro\nimcache\claro_claro.o f:\claro-air\n
imrod\projects\claro\nimcache\nimrod_system.o f:\claro-air\nimrod\projects\claro\nimcache\claro_tt.o
Hint: operation successful (12169 lines compiled; 5.338 sec total; 8.819MB) [SuccessX]

F:\Claro-AIR\nimrod\projects\claro>

« Last Edit: October 07, 2013, 02:56:07 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #41 on: October 07, 2013, 04:28:04 PM »
Is there a C style include for Claro I can build a DLLC interface from?


Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #42 on: October 07, 2013, 04:38:55 PM »
Have you looked inside the Claro "include" folder?  :P :P  ;D

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: Claro-AIR
« Reply #43 on: October 07, 2013, 04:46:07 PM »
 :o  ??? ::)

Which one?

The claro.nim seems to be the best resource at the moment unless you can get me back on the C path with a consolidated .h

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: Claro-AIR
« Reply #44 on: October 07, 2013, 04:48:15 PM »
One thing's been bugging me about the Nimrod interface file to Claro.

With most GUI toolkits, you have the ability to assign an ID to an object, making it easier to code a single proc for all button actions, for example.  You just ask the sender (the button) to give you the ID you set, so you know which button is actually calling the proc at that time.

Claro doesn't seem to have that ability directly, and the Claro.nim file doesn't either.

At least not until now.

What I did was modify the TWidget type in the Claro.nim file, to add an "id" property:

Code: [Select]
  TWidget* {.pure.} = object of TClaroObj
    size_req*: ptr TBounds
    size*: TBounds
    size_ct*: TBounds
    supports_alpha*: cint
    size_flags*: cint
    flags*: cint
    visible*: cint
    notify_flags*: cint
    id*: int # added to provide alternate means of identifiying objects  <--HERE
    font*: TFont
    native*: pointer          # native widget
    ndata*: pointer           # additional native data
    container*: pointer       # native widget container (if not ->native)
    naddress*: array[0..3, pointer] # addressed for something
                                    # we override or need to remember

Up to now, I had been using the "naddress" property to store the button id, but the code to set and get the value was fugly and non-intuitive:

Code: [Select]
#SETTER
buttons[i].naddress[0] = cast[ptr int](i+1)

#GETTER
var multiplyer = cast[int](button.naddress[0])

Once I added the "id" property, I was able to modify the code to something a lot more clean and intuitive:
Code: [Select]
#SETTER
buttons[i].id = (i+1)

#GETTER
var multiplyer = button.id

Much cleaner and clear, right?

The other thing that was bothering me was this line:
Code: [Select]
buf &= IntToStr(multiplyer) & " x " & IntToStr(i) & " = " & IntToStr( multiplyer*i ) & "\n"
Nimrod has a cool shortcut (the Dollar Sign) that converts a number to a string.  So now it looks like this:
Code: [Select]
buf &= $multiplyer & " x " & $i & " = " & $( multiplyer*i ) & "\n"
More in line with a BASIC-Like approach, I think.  At least the overall code is cleaner now.  ;D

The best thing about being able to add an "id" property with Nimrod is that I didn't have to recompile the Claro library.  All I needed to do was modify the Claro.nim file with one simple addition, and change my own code to reflect that.

Very cool language, Nimrod.  Thanks John for finding it and sharing!


AIR.