Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

Newb Window Canvas Question

Integrated Application Platform › Forums › General › Newb Window Canvas Question

  • This topic has 7 replies, 2 voices, and was last updated 11 years, 10 months ago by roundtuit.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • April 9, 2011 at 1:09 pm #695
    roundtuit
    Participant

    I have created a window (see code below) that contains a Menu and a Canvas. After creating the window, I do some other things in Dialogs and now want to get back to my Canvas to add some items to it. I cannot find how to do that. Anyone help? Please?


    Window(Controller
    {
    Title: "Stuff"


    Commands:
    (
    (Cut, "Ctrl+X", "Cut the selected text to the clipboard")
    (Copy, "Ctrl+C", "Copy the selected text to the clipboard")
    (Paste, "Ctrl+V", "Insert the contents of the clipboard")
    )
    Menu:
    (
    ("&AAAAA",
    "&Add", "&Browse", "&Edit")
    ("&BBBBB",
    "&Add", "&Browse", "&Edit", "&Delete")
    ("&CCCCC",
    "&Add", "&Browse", "&Edit", "&Delete")
    ("&DDDDD",
    "&Indiv Payment", "&Bulk Payment", "&Notice")
    )
    Controls:
    (Vert
    (Canvas)
    )
    })

    //Do some stuff here in Dialogs

    ob = .Vert.Canvas results in "Function does not support get" here
    ob.AddItem(CanvasText("Test",50, 50, 150, 150, ))

    April 9, 2011 at 1:33 pm #826
    amckinlay
    Keymaster

    You need to keep a reference to the Window.

    w = Window(…

    Then you can do:

    w.Vert.Canvas.AddItem(…

    Or if it’s just setup stuff, you can do it in a New method in the Controller.

    I’m not sure how much Canvas has been used lately so let me know if there are any problems.

    April 9, 2011 at 5:34 pm #827
    roundtuit
    Participant

    OK, I turned my nifty little window builder into a function with a

    return w

    Just prior to the return, from withing the function I tried

    w.Vert.Canvas.AddItem( which yielded “uninitialized member: #Vert”

    So I tried the same thing external to the function and still got the same error.

    April 9, 2011 at 5:54 pm #828
    amckinlay
    Keymaster

    Sorry, my mistake.

    Here’s what I ran from the WorkSpace:

    w = Window(#(Vert (Canvas)))
    w.Vert.Canvas

    I missed that you’re using a Controller, so it becomes:

    w = Window(Controller { Controls: (Vert (Static hello)) })
    w.Ctrl.Vert.Canvas

    (the top level control in a window can be referenced as Ctrl)

    You can always do Inspect(w) to see what you’re getting.

    It is often better is to use FindControl

    w.FindControl(‘Canvas’)

    This will search through the control tree for a control with that name, so it won’t break when you change your layout.

    If you have multiple controls of the same type you need to give them unique names:

    (Vert (Field name: one) (Field name: two))

    April 9, 2011 at 6:57 pm #829
    roundtuit
    Participant

    Perfect! Works like a charm and even makes sense to this old brain. Thanks much!!!

    April 11, 2011 at 3:32 pm #830
    roundtuit
    Participant

    Still just a little lost… I run my function to create the window (w = MyFunc) and it returns the pointer to the window (window object) as w beautifully. There’s my Window, my Menu, My canvas. Everything is wonderful. now I get the pointer to my canvas (oc = w.FindControl(‘Canvas’)) and there it is, big and beautiful as life…My Canvas. Now, silly me, I want to put an image on my canvas so I try to create an image object with oi = Image(“MyFile.jpg”) so that I can add it (oc.AddItem) to my canvas. No joy in Mudville. Image(“MyFile.jpg”) just appears to return a string that says “Image (“MyFile.jpg”)” and not an object that I can manipulate or add to the canvas. I’m trying all this from the workspace, 1 line at a time so I can see what I’m getting. What did I do wrong THIS time?

    Oh, and is there something simple I can specify in my Window creation function that will start the window maximized? Thanks so much and sorry to be such a bother.

    April 11, 2011 at 4:41 pm #831
    amckinlay
    Keymaster

    I think you need to add a CanvasImage. Image is a lower level built-in class for loading image files.

    Canvas was written for DrawControl (SuneiDraw). You can look at the DrawControl code for usage.

    Is there a particular reason you are using Canvas? You’re welcome to use it, but it’s not the normal user interface for Suneido. (We don’t use it in any of our applications.)

    April 11, 2011 at 6:24 pm #832
    roundtuit
    Participant

    @amckinlay wrote:

    Is there a particular reason you are using Canvas? You’re welcome to use it, but it’s not the normal user interface for Suneido. (We don’t use it in any of our applications.)

    Ahh… I see, I chose the chainsaw instead of the hammer to drive the nail, sorry about that and thanks for pointing out the hammer… MUCH better. Canvas looks like a cute control that I could use to do some interesting things, have some fun with and let the user possibly have some fun with as well. Maybe I’ll give them some pens and crayons and they can doodle and color while they wait on the phone, instead of using up the boss’ paper pads. I rarely do anything as mundane as “normal”, life is too short! 😉

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Log In

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language