locked
Diverse problems RRS feed

  • Question

  • Hey guys!

    I am updating my "Install Shield Wizard" (called InstallTime) at the moment. But I have 2 problems. I hope you can help me. That's my code: LJM030

    That's the problems:

    - I added a few buttons. Four of them are a bit special. If you click them, they should change their caption. But this only work for the first three buttons. The fourth do not want work.  I used the same code for it...

    - The next problem is about the textboxes. I added a few of them, and everytime you change the side everything in them will save. But, if you go back to the side is not everything in the boxes. It is difficult for me to explain it better, but I miss the right words. Simply try it yourself. Write in every box on every side and then switch between the sides. Then you will see the problem.

    Thanks in advance.


    Greetings Timo

    Sunday, December 16, 2012 12:45 PM

Answers

  • Point 1]

    I did a format program to set the indentation and put a writeline in:

        ElseIf CapLCB = "No" Then
          Controls.SetButtonCaption(SButton[3], SButCap[1][Lang])
        ElseIf CapLCB = "Nein" Then
          Controls.SetButtonCaption(SButton[3], SButCap[1][Lang])
          
        ElseIf LCB = SButton[4] Then 'SPEZIALBUTTON JA/NEIN
                        TextWindow.WriteLine("HERE")
    
          CapLCB = Controls.GetButtonCaption(SButton[4])
          If CapLCB = "Yes" Then
            Controls.SetButtonCaption(SButton[4], SButCap[2][Lang])

    We can see an EndIf is misplaced closing the code block before "ElseIf LCB = SButton[4] Then"

    On point 2] Not sure I follow - by "side" do you mean Next and Back.

    The following test code seems to show it working:

      For i = 1 To Array.GetItemCount(Box)
        TextWindow.WriteLine(i+" : "+side+" : "+Box[side][i]+" : "+BoxText[side][i])
        Controls.SetTextBoxText(Box[side][i], BoxText[side][i])
      EndFor
    Must be something else you mean?



    • Edited by litdev Sunday, December 16, 2012 3:25 PM
    • Marked as answer by Timo Sö Monday, December 17, 2012 12:07 PM
    Sunday, December 16, 2012 1:05 PM
  • Tricky one.

    Recall this code, where wecan get output of what is happening:

      For i = 1 To Array.GetItemCount(Box)
        TextWindow.WriteLine(i+" : "+side+" : "+Box[side][i]+" : "+BoxText[side][i])
        Controls.SetTextBoxText(Box[side][i], BoxText[side][i])
      EndFor

    Note that i is looping of the size of array Box, actually we want the size of sub array Box[side].

    For i = 1 To Array.GetItemCount(Box[side])

    PS although side is the translation, page is a better term in English for this - I admire your ability in a second language.

    PPS The reason I didn't see the problem first time was that I went all the way to page 3 before going back and it all looked fine!

    Also, note that you are creating new TextBoxes each time a page is loaded; you just need to create them all once at the beginning and Hide/Show as appropriate.  Not a big issue (we see this from the TextBox names in the debug output I added), but for a bigger program they would mount up - this is called a 'memory leak' - not cleaning things up and it is good practice to be mindful of it as it will cause problems sometimes and it can be very hard to debug.

    This is the most common cause of SmallBasic games gradually slowing, I recall somewhere that Ed Price noticed this for one of the team challenge games when he ran it overnight.

    • Edited by litdev Sunday, December 16, 2012 6:58 PM
    • Marked as answer by Timo Sö Monday, December 17, 2012 12:07 PM
    Sunday, December 16, 2012 6:24 PM

All replies

  • Point 1]

    I did a format program to set the indentation and put a writeline in:

        ElseIf CapLCB = "No" Then
          Controls.SetButtonCaption(SButton[3], SButCap[1][Lang])
        ElseIf CapLCB = "Nein" Then
          Controls.SetButtonCaption(SButton[3], SButCap[1][Lang])
          
        ElseIf LCB = SButton[4] Then 'SPEZIALBUTTON JA/NEIN
                        TextWindow.WriteLine("HERE")
    
          CapLCB = Controls.GetButtonCaption(SButton[4])
          If CapLCB = "Yes" Then
            Controls.SetButtonCaption(SButton[4], SButCap[2][Lang])

    We can see an EndIf is misplaced closing the code block before "ElseIf LCB = SButton[4] Then"

    On point 2] Not sure I follow - by "side" do you mean Next and Back.

    The following test code seems to show it working:

      For i = 1 To Array.GetItemCount(Box)
        TextWindow.WriteLine(i+" : "+side+" : "+Box[side][i]+" : "+BoxText[side][i])
        Controls.SetTextBoxText(Box[side][i], BoxText[side][i])
      EndFor
    Must be something else you mean?



    • Edited by litdev Sunday, December 16, 2012 3:25 PM
    • Marked as answer by Timo Sö Monday, December 17, 2012 12:07 PM
    Sunday, December 16, 2012 1:05 PM
  • Timo,

    I think English readers understand you better if you use the translation "page" instead of "site" for "Seite".


    Jan [ WhTurner ] The Netherlands

    Sunday, December 16, 2012 1:07 PM
    Answerer
  • @WhTuner33

    I used "side" and tht is English for "Seite"(in German). ;)

    @LitDev

    Thanks for the Buttonfix! It works now very well.

    Next, I use the variable "side" to count the side number. Then I clean the texts in the window, hide the controls and then I reload the side.

    Before the side will change, I save the textboxes in a variable.  If the side will reload, they should appear in the textboxes. But this won't work correctly.

    Example:

    I wrote in the first 3 boxes "a". In the 4-6 box I wrote "b". And the 7 box I wrote "c".

    If I go back to side 1, there is in min. 1 box "b" insteat of "a". That's what I mean't with the textbox bug. It would be nice if you could help me here.


    Greetings Timo

    Sunday, December 16, 2012 6:04 PM
  • Tricky one.

    Recall this code, where wecan get output of what is happening:

      For i = 1 To Array.GetItemCount(Box)
        TextWindow.WriteLine(i+" : "+side+" : "+Box[side][i]+" : "+BoxText[side][i])
        Controls.SetTextBoxText(Box[side][i], BoxText[side][i])
      EndFor

    Note that i is looping of the size of array Box, actually we want the size of sub array Box[side].

    For i = 1 To Array.GetItemCount(Box[side])

    PS although side is the translation, page is a better term in English for this - I admire your ability in a second language.

    PPS The reason I didn't see the problem first time was that I went all the way to page 3 before going back and it all looked fine!

    Also, note that you are creating new TextBoxes each time a page is loaded; you just need to create them all once at the beginning and Hide/Show as appropriate.  Not a big issue (we see this from the TextBox names in the debug output I added), but for a bigger program they would mount up - this is called a 'memory leak' - not cleaning things up and it is good practice to be mindful of it as it will cause problems sometimes and it can be very hard to debug.

    This is the most common cause of SmallBasic games gradually slowing, I recall somewhere that Ed Price noticed this for one of the team challenge games when he ran it overnight.

    • Edited by litdev Sunday, December 16, 2012 6:58 PM
    • Marked as answer by Timo Sö Monday, December 17, 2012 12:07 PM
    Sunday, December 16, 2012 6:24 PM
  • Thanks LitDev! It works now very well.

    I will use page in the future. :)

    So, I will correct the creating textbox mistake asap.

    Thanks very much!


    Greetings Timo

    Monday, December 17, 2012 12:07 PM