none
Can't get part of Fremy API to work RRS feed

  • Question

  • Dear Fremy,

    Can't get this code to work. Graphics window is shown and also the control box with the smiley button but that's it.
    No graphs or graphics. What's wrong or am I missing here....
    Thanks,


    GraphicsWindow.Show()
    GraphicsWindow.BackgroundColor = "#FFEEDD"
    ImagePath = "C:\Documents and Settings\dep14162\My Documents\SmallBasic\Art\IntellisenseSubroutine.png"
    ' Create a square :
    Array.SetValue("Arr1", 0, 0)
    Array.SetValue("Arr1", 1, 0)
    Array.SetValue("Arr1", 2, 10)
    Array.SetValue("Arr1", 3, 0)
    Array.SetValue("Arr1", 4, 10)
    Array.SetValue("Arr1", 5, 10)
    Array.SetValue("Arr1", 6, 0)
    Array.SetValue("Arr1", 7, 10)
    MyCurve = Drawings.CreateEmpyGraphics(85,137)
    MyPicture = Drawings.CreateGraphics(ImagePath)
    Controls.Move(MyPicture, 125, 150)
    Controls.Move(MyCurve,35,37)
    Controls.SetText(MyCurve, "Mijn Curve")

    Drawings.DrawCurve(MyCurve, 230, 6, "Arr1")

    GraphicsWindow.ShowMessage("THE END!",":)")
           


    Program.End()

    Tuesday, September 22, 2009 3:04 PM

Answers

  • Please import this application. PLR196.
    I try to show you what changed since v0.3. (Arrays, Image generation, ...)

    If you've any additionnal question, feel free to ask !
    Fremy
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Marked as answer by Hobby_Dev Tuesday, September 22, 2009 7:30 PM
    Tuesday, September 22, 2009 7:11 PM
  • Ai ai now I feel uncomfortable. ;-)
    I'm using V0.6 and also with V0.5 it did not work.
    Btw your code on the smallbasic forum which lists as such:

    Array.SetValue("Args", 0, "Bonjour ")
    Builder = Interop.CreateObject("System.Text.StringBuilder","Args")
    ClearArgs()
    
    Array.SetValue("Args", 0, "Objet StringBuilder créé !")
    Array.SetValue("Args", 1, "My TestApp for Interop")
    Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", "Args")
    ClearArgs()
    
    TextWindow.Write("Entrez votre nom ici : ")
    
    Array.SetValue("Args", 0, TextWindow.Read())
    Interop.CallSub(Builder, "Append", "Args")
    ClearArgs()
    
    Array.SetValue("Args", 0, "L'objet StringBuilder semble avoir fonctionné correctement")
    Array.SetValue("Args", 1, "My TestApp for Interop")
    Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", "Args")
    ClearArgs()
    
    TextWindow.WriteLine(Interop.ToString(Builder))
    TextWindow.Read()
    
    Sub ClearArgs
      For ArgsCleanerIndex = 0 To Array.GetItemCount("Args")
        Array.RemoveValue("Args", ArgsCleanerIndex)
      EndFor
    EndSub

    Creates in my case following error situation:

    System.NullReferenceException: Object reference can not be set to an instance of an object.
            at FC.Interop.CallSharedSub(Primitive Typename, Primitive Subname, Primitive ArgsArray)


    It's actually a Windows Box which pops-up twice during runtime.

    Any pointers here?
    • Marked as answer by Hobby_Dev Tuesday, September 22, 2009 6:53 PM
    Tuesday, September 22, 2009 6:53 PM

All replies

  • Hi !

    I've seen where your code "fails". I'll send you a corrected code in a few time.
    You're using a code for sb v0.3. Many things have changed now.

    Thank you for your interest,
    Fremy
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Tuesday, September 22, 2009 5:59 PM
  • Ai ai now I feel uncomfortable. ;-)
    I'm using V0.6 and also with V0.5 it did not work.
    Btw your code on the smallbasic forum which lists as such:

    Array.SetValue("Args", 0, "Bonjour ")
    Builder = Interop.CreateObject("System.Text.StringBuilder","Args")
    ClearArgs()
    
    Array.SetValue("Args", 0, "Objet StringBuilder créé !")
    Array.SetValue("Args", 1, "My TestApp for Interop")
    Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", "Args")
    ClearArgs()
    
    TextWindow.Write("Entrez votre nom ici : ")
    
    Array.SetValue("Args", 0, TextWindow.Read())
    Interop.CallSub(Builder, "Append", "Args")
    ClearArgs()
    
    Array.SetValue("Args", 0, "L'objet StringBuilder semble avoir fonctionné correctement")
    Array.SetValue("Args", 1, "My TestApp for Interop")
    Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", "Args")
    ClearArgs()
    
    TextWindow.WriteLine(Interop.ToString(Builder))
    TextWindow.Read()
    
    Sub ClearArgs
      For ArgsCleanerIndex = 0 To Array.GetItemCount("Args")
        Array.RemoveValue("Args", ArgsCleanerIndex)
      EndFor
    EndSub

    Creates in my case following error situation:

    System.NullReferenceException: Object reference can not be set to an instance of an object.
            at FC.Interop.CallSharedSub(Primitive Typename, Primitive Subname, Primitive ArgsArray)


    It's actually a Windows Box which pops-up twice during runtime.

    Any pointers here?
    • Marked as answer by Hobby_Dev Tuesday, September 22, 2009 6:53 PM
    Tuesday, September 22, 2009 6:53 PM
  • Please import this application. PLR196.
    I try to show you what changed since v0.3. (Arrays, Image generation, ...)

    If you've any additionnal question, feel free to ask !
    Fremy
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Marked as answer by Hobby_Dev Tuesday, September 22, 2009 7:30 PM
    Tuesday, September 22, 2009 7:11 PM
  • For the 2nd sample you posted, you should replace every Array.SetValue("Args", {INDEX}, {VALUE}) by Args[{INDEX}] = {VALUE}.
    Every , "Args") by , Args)
    And Sub ClearArgs by
    Sub ClearArgs
       Args = ""
    EndSub

    It should then work.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Tuesday, September 22, 2009 7:15 PM
  • Yes I start to understand now. Array functionality has 'changed' w.r.t. syntax. Furthermore you made me understand that:
    1. Set-up the drawing (or image)
    2. Create the drawing (or image)
    3. Generate the image
    4. Position the image (this step actually put's in into the GraphicsWindow

    Thanks!
    Tuesday, September 22, 2009 7:30 PM
  • Brilliant, it does work now!
    Herewith my French to English translation: GNX021
    Care to re-publish on the wiki?

    Regards,
    Tuesday, September 22, 2009 7:39 PM
  • Brilliant, it does work now!
    Herewith my French to English translation: GNX021
    Care to re-publish on the wiki?

    Regards,

    Ok, I'll add updating the wiki on my to-do list. Many things already in it, but I'll have free time tomorow (hum, since it's 0:20 am in my country, I should say today) and I'll care about that.

    Thanks for the remind.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Tuesday, September 22, 2009 10:20 PM