A Windows utility

Hello.
I have made my library of utilities available on my site: http://jmv38.comze.com/CODEAbis/server.php .
A video introduction is there:
http://www.youtube.com/watch?v=1vl986B9yl4
This library contains:

  • a memory monitor.
  • a fps monitor.
  • a clock.
  • a LUA objects explorer.
  • a custom message box function.
  • A custom menu function.
  • a custom windows manager.
  • printing can be redirected to any window (images and text supported).
  • multiple alignment options.
  • printable buttons.
  • there is a tutorial documentation included.
  • all the graphics set up are done by touch and the result is saved in a tab of your current project (make a dependancy to this project to include it).
    Here is a code to quick start:
-- Main

displayMode(FULLSCREEN)

function setup()
    windows = Windows()
    windowsSmallExample()
end

function draw()
    background(109, 109, 109, 255)
    -- put your drawing before this line
    if windows then windows:draw() end
end

function touched(touch)
    if windows then touch = windows:touched(touch) end
    if not touch then return end
    -- put your touch after this line
end

function windowsSmallExample()
    local str1 = "message1"
    local str2 = "message2"    
    local str3 = "print text"
    local str4 = "print button"
    
    local callback = function(str) 
        windows:message("you have tapped on: "..str)
    end
    
    local func = function(txt)
            if txt == str1 then
                windows:message("Hello this is a simple message")
            elseif txt == str2 then
                windows:message("Choose:","yes","no","cancel",callback)
            elseif txt == str3 then
                local win = windows:get("printer")
                win:print("hello")
                win:frameShow(true)
            elseif txt == str4 then
                local win = windows:get("printer")
                local button1 = WindowButton("yes",callback)
                local button2 = WindowButton("no",callback)
                win:print(button1)
                win:print("   ")
                win:print(button2)
                win:frameShow(true)
            end
        end
        
    windows:menu("myMenu",str1,str2,str3,str4,func)
end

Let me know your feedback.
Oh, one last word: heavy playing with the parameter panel is a bit unstable on my ipad1. I experience from time to time some codea crash when i do many changes. Besides this, my code seems ok (but it is difficult to be sure: 4500 lines…)

@Jmv38… I really like it. Actually my favorite part is the in-program tutorial. I wouldn’t mind using it to make a Codea Tutorial. …hmmm.

.@Ric_Esrey go ahead! I put this code in public domain for anyone to use it.

Very cool, thanks!

Hi all. Is it ok for you to copy the code? It seems too long form me. If you heve the same problem, i’ll split the file in 3 smaller ones.

I have dowloaded my own code with difficulty, but then the only way to make it work is to paste everything in a single tab. If poeple are interested by this code, and @Simeon does not find a fix, i’ll rework my link to improve the situation…

Mine broke out into tabs just fine

It won’t paste into my iPad 3 at all, but I’ll try again later

It separated into tabs quite nicely for me. Thanks @Jmv38.

That object explorer looks really useful.
I am also blown away by the 3d globe, I was only wondering yesterday how to create sphere mesh.
I will look forward to looking through your code to figure out how it works.

Thanks for sharing.

I see a ‘‘huge’’ number of downloads (>40 is huge for me) but very little feedback on the forum… Is it there is a problem and it doesnt work? Or maybe it takes time to use the stuff? My basic idea was it should be really simple to use, hence the ‘windows:print’, ‘windows:message’ and ‘windows:menu’ functions, as in the short example, with all the size and positionning and coloring managed manually without programming anything. Let me know if there is a problem.

This looks very cool! My son and I will probably test out in the next day or so. Well done!

Sorry, I guess I am among the 40, did not have time to test it extensively but it looks and works great after a few tries. thanks

Hey @Jmv38!!! I’m experimenting with your awesome windows utility and I noticed a possible issue. I built a new message window with:

window:message("Hello World", close)

When I run the program, the message window pops up as expected. The problem occurs when I try to adjust the message window’s size and position. I can move my message window around using the parameter sliders but when I stop and rerun the program, the window appears in its original position. It doesn’t remember the position I gave it (it does, however, remember the size).

Ok thanks for the feedback guys.
@ric_esrey i made the message window forced to align in the center of the display. This is why it will always come back in the center. Do you really need it to move it? If yes, i’ll add a setting to devalidate the ‘auto_center’ option.

@Jmv38… I can see where you would want the message window popping up in the center of the screen. For most purposes, I probably would want the same behaviour. Yet for the UI tutorial, that I was thinking about writing, I wanted the message window to pop up toward the bottom left, when I talked about the command line. Afterward, I wanted to move the window to the top of the screen to discuss the parameter area and the output area.

Later, I would like to have two message windows open at the same time (one for explanation and one for code). At that point, I would like to make the message boxes so they don’t fall on top of each other.

So, yes, it would be nice if you would give me the option to move the messages. Thanks for your hard work on this. I really like it.

Hi Ric.
I have checked in my code, what you need is already there (put the move after sending the message)

    local  win = windows:get("message")
    win:lock(false)
   
-- more code.  .....

    windows:message("hello")
    win:move({left=100, top=100})

this unlocks the message window (you can also do it manually).
Then you move the window where you want with move.
Does it do the job?
Ps: there is also a function to resize it if you need.

@Jmv38… That works. Thanks.

I’ve used the library to make quickly two small programs with interfaces. I saw there are still a few things to improve to make it really 100% easy to use:

  • tutorial should be easily removable, it is not.
  • the window autosave should save only the settings different from default options.
  • newline function missing.
  • buttons dont layout as they should.
  • i have to define a simple used function to add callback to images and text (current way is an internal function not supposed to be used by end users).
  • When a window is behind another i can no longer access to it: i must add a way to select it from the settings panel. Also it should be possible to move the window zlevel from the panel (zlevel not used today).
  • i should add a parameter ‘lines’ similar to ‘columns’ that presets the number of lines and their height.
    Some people may have difficulties just to copy and paste the code because it is so long (i had difficulties!). I might make a code loader, from one of the examples posted on the forum (Codeslinger’s maybe).
    I’ll do the changes soon.
    (more or less)

hi every one.
Thanks to the help of @Mpilgrem, i have designed a project downloader. No more hassle to download 3500 lines projects. I have added to my site http://jmv38.comze.com/CODEAbis/server.php the 2 small projects designed for Luger, with the library included (so you should not make any dependency to these project for them to run, they are stand-alone). You can download them if you want to see the result (i wont post the code in the forum because i want to know how many people download the code: since most of the users dont post any comment on the forum, it is the only way for me to know how many people are interested). Actually they contain a sligthtly improved version of the library:

  • images can have callbacks (via an internal function however, i’ll design a user function later)
  • the tutorial is removed: it will stop popping up all the time. I’ll add it back later with a better way.
    Hope you like it!