Author Topic: How to work with dynamic, Excel-style $tring tables in InForm?  (Read 19099 times)

0 Members and 1 Guest are viewing this topic.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #30 on: June 11, 2020, 06:41:50 pm »
couldn't you do a double-click on the list-item?
no need for a button, simply double-click on the items you want to copy, perhaps you could have text-box where the double-clicked items would be placed for further processing.
[edit]
or a single-click

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #31 on: June 11, 2020, 06:51:25 pm »
Hi
@DDBE
I have tried you form (.frm + .bas) and I can confirm the issues exposed by Bplus over.
1. why the END instruction at line 117 where it was the hacker call to __UI_Click? Cancelling it the program runs.

2. Why do you use a so expanded window?  It goes out of my aspireone netbook! I cannot see all the window of the program. It is difficult to say if it works well or bad.

3. why are yet there the PRINT statements ? Inform generates a 32bit window so the instructions COLOR 8 and COLOR 0  are of no value.

4. if you do a double-click or a sigle click on the listbox void you get an Error divide for 0 and it crashes.
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #32 on: June 11, 2020, 07:17:55 pm »
Oh hey! Fellippe has a MessageBox Function for InForm. You might use that to check the contents of the Clipboard since we are out or room with the Form.

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #33 on: June 12, 2020, 01:08:05 am »
Okay, so I've removed the END and fixed the asisgnment of MC$, tried running the program and even though I hadn't made a single change since I'd gotten lots of error msgs on the original .frm (outside of removing the END), it magically fired up. But I found there was a blank in front of every Pisces in the dropdowns, effectively making the program ignore every single point meant to go to Pisces, although printing everything just fine (except for the headline for each table, which still were PRINT commands which InForm simply ignored).

So then I went and...

  • removed that blank in front of every Pisces,
  • added a second button for copying,
  • changed all the PRINT commands to AddItem ListBox1 commands,
  • added the _CLIPBOARD$ = Text(ListBox1) command inside the CASE Button_copy event (which in turn is inside SELECT CASE id, which in itself is inside __UI_Click),

then I ran the program again, and...

...ever since then, the program crashes whenever I hit the GO! button! ;.; New .zip with the files at the bottom.
* HorCalc.zip (Filesize: 88.89 KB, Downloads: 439)
« Last Edit: June 12, 2020, 01:15:40 am by DDBE »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #34 on: June 12, 2020, 01:40:18 am »
What was different about Pisces that caused the space?

How did you addItem the blank PRINT lines?

This could have been simply appended to code for GO
_CLIPBOARD$ = Text(ListBox1)
« Last Edit: June 12, 2020, 02:25:06 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #35 on: June 12, 2020, 02:16:43 am »
I left Pisces alone, used this:
Code: QB64: [Select]
  1. AddItem ListBox1, " "
for blank lines because "" might cause problems, it does printing to files.
Just added this:
Code: QB64: [Select]
  1. _CLIPBOARD$ = Text(ListBox1)
to the end of the GO button code

Totally Random filling out Form
From the Clipboard pasted into text file:
Code: QB64: [Select]
  1. Additional astrological calculations based upon the natal chart of
  2.  
  3. born ,,
  4.  
  5.  
  6. Elements:
  7.  
  8. The sum of the fire signs in this birth chart is 24. Thus, its owner is determined by the element of fire by 32.43%.
  9. The sum of the air signs in this birth chart is 22. Thus, its owner is determined by the element of air by 29.73%.
  10. The sum of the water signs in this birth chart is 14. Thus, its owner is determined by the element of water by 18.92%.
  11. The sum of the earth signs in this birth chart is 14. Thus, its owner is determined by the element of earth by 18.92%.
  12.  
  13. Dominance of the signs:
  14.  
  15. Strength of Leo: 18 ( 24.32%)
  16. Strength of Virgo: 14 ( 18.92%)
  17. Strength of Cancer: 12 ( 16.22%)
  18. Strength of Gemini: 12 ( 16.22%)
  19. Strength of Libra: 6 ( 8.11%)
  20. Strength of Aries: 5 ( 6.76%)
  21. Strength of Aquarius: 4 ( 5.41%)
  22. Strength of Scorpio: 2 ( 2.7%)
  23. Strength of Sagittarius: 1 ( 1.35%)
  24. Strength of Pisces: 0 ( 0%)
  25. Strength of Taurus: 0 ( 0%)
  26. Strength of Capricorn: 0 ( 0%)
  27.  
  28. At a strength of 18( 24.32% ), Leo is the dominant sign.
  29.  
  30. Qualities:
  31.  
  32. The sum of the mutable signs in this birth chart is 27. Thus, its owner is characterized by mutable qualities at 36.49%.
  33. The sum of the fixed signs in this birth chart is 24. Thus, its owner is characterized by fixed qualities at 32.43%.
  34. The sum of the cardinal signs in this birth chart is 23. Thus, its owner is characterized by cardinal qualities at 31.08%.
  35.  
  36. Polarities:
  37.  
  38. The sum of the passive signs in this birth chart is 36. Thus, its owner is characterized by passive polarities at 48.65%.
  39. The sum of the active signs in this birth chart is 38. Thus, its owner is characterized by active polarities at 51.35%.
  40.  
  41. Dominance of the houses:
  42.  
  43. Strength of the 6th house:  19 ( 33.33%)
  44. Strength of the 7th house:  14 ( 24.56%)
  45. Strength of the 8th house:  12 ( 21.05%)
  46. Strength of the 10th house:  6 ( 10.53%)
  47. Strength of the 5th house:  4 ( 7.02%)
  48. Strength of the 9th house:  2 ( 3.51%)
  49. Strength of the 12th house:  0 ( 0%)
  50. Strength of the 11th house:  0 ( 0%)
  51. Strength of the 4th house:  0 ( 0%)
  52. Strength of the 3rd house:  0 ( 0%)
  53. Strength of the 2nd house:  0 ( 0%)
  54. Strength of the 1st house:  0 ( 0%)
  55.  
  56. The dominant house in this birth chart is house no. 6( 33.33% ).
  57.  
  58. Dominance of the quadrants:
  59.  
  60. Strength of the 3rd quadrant:  28 ( 49.12%)
  61. Strength of the 2nd quadrant:  23 ( 40.35%)
  62. Strength of the 4th quadrant:  6 ( 10.53%)
  63. Strength of the 1st quadrant:  0 ( 0%)
  64.  
  65. The dominant quadrant is the 3rd aka Air or intellectual quadrant at  49.12%.
  66.  
  67. For the dominant celestial body in this birth chart, enter its birth place and birth time at www.astro.com and then select the 'Color Oracle'.
  68.  
  69.  


Update: I have removed the .zip here and reduced the new smaller zip by eliminating 2 exe files.
I have redone the mod fixing the .frm file for "Pisces" by removing all that had spaces.
B+ current best .zip attachment here: https://www.qb64.org/forum/index.php?topic=2696.msg119138#msg119138
« Last Edit: June 12, 2020, 02:31:18 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #36 on: June 12, 2020, 02:32:26 am »
Testing download of zip, I tried a pattern for filling out form.

From clipboard to text editor:
Code: QB64: [Select]
  1. Additional astrological calculations based upon the natal chart of
  2.  
  3. born ,,
  4.  
  5.  
  6. Elements:
  7.  
  8. The sum of the earth signs in this birth chart is 32. Thus, its owner is determined by the element of earth by 43.24%.
  9. The sum of the fire signs in this birth chart is 23. Thus, its owner is determined by the element of fire by 31.08%.
  10. The sum of the air signs in this birth chart is 19. Thus, its owner is determined by the element of air by 25.68%.
  11. The sum of the water signs in this birth chart is 0. Thus, its owner is determined by the element of water by 0%.
  12.  
  13. Dominance of the signs:
  14.  
  15. Strength of Virgo: 32 ( 43.24%)
  16. Strength of Sagittarius: 23 ( 31.08%)
  17. Strength of Gemini: 19 ( 25.68%)
  18. Strength of Scorpio: 0 ( 0%)
  19. Strength of Capricorn: 0 ( 0%)
  20. Strength of Pisces: 0 ( 0%)
  21. Strength of Aquarius: 0 ( 0%)
  22. Strength of Cancer: 0 ( 0%)
  23. Strength of Taurus: 0 ( 0%)
  24. Strength of Leo: 0 ( 0%)
  25. Strength of Libra: 0 ( 0%)
  26. Strength of Aries: 0 ( 0%)
  27.  
  28. At a strength of 32( 43.24% ), Virgo is the dominant sign.
  29.  
  30. Qualities:
  31.  
  32. The sum of the mutable signs in this birth chart is 74. Thus, its owner is characterized by mutable qualities at 100%.
  33. The sum of the fixed signs in this birth chart is 0. Thus, its owner is characterized by fixed qualities at 0%.
  34. The sum of the cardinal signs in this birth chart is 0. Thus, its owner is characterized by cardinal qualities at 0%.
  35.  
  36. Polarities:
  37.  
  38. The sum of the passive signs in this birth chart is 19. Thus, its owner is characterized by passive polarities at 25.68%.
  39. The sum of the active signs in this birth chart is 55. Thus, its owner is characterized by active polarities at 74.32%.
  40.  
  41. Dominance of the houses:
  42.  
  43. Strength of the 3rd house:  22 ( 38.6%)
  44. Strength of the 6th house:  18 ( 31.58%)
  45. Strength of the 7th house:  12 ( 21.05%)
  46. Strength of the 9th house:  5 ( 8.77%)
  47. Strength of the 10th house:  0 ( 0%)
  48. Strength of the 12th house:  0 ( 0%)
  49. Strength of the 11th house:  0 ( 0%)
  50. Strength of the 8th house:  0 ( 0%)
  51. Strength of the 5th house:  0 ( 0%)
  52. Strength of the 4th house:  0 ( 0%)
  53. Strength of the 2nd house:  0 ( 0%)
  54. Strength of the 1st house:  0 ( 0%)
  55.  
  56. The dominant house in this birth chart is house no. 3( 38.6% ).
  57.  
  58. Dominance of the quadrants:
  59.  
  60. Strength of the 1st quadrant:  22 ( 38.6%)
  61. Strength of the 2nd quadrant:  18 ( 31.58%)
  62. Strength of the 3rd quadrant:  17 ( 29.82%)
  63. Strength of the 4th quadrant:  0 ( 0%)
  64.  
  65. The dominant quadrant is the 1st aka Fire or energy quadrant at  38.6%.
  66.  
  67. For the dominant celestial body in this birth chart, enter its birth place and birth time at www.astro.com and then select the 'Color Oracle'.
  68.  
  69.  

Is it unusual in any way? Oh hey fire and energy, I was using Tesla's favorite numbers! cool!
« Last Edit: June 12, 2020, 02:33:52 am by bplus »

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #37 on: June 12, 2020, 05:39:05 am »
What was different about Pisces that caused the space?

When I'd originally typed the sign names into the InForm field for the dropdowns, I tried to separate them by means of semicolons, whereby InForm automatically added a blank between every single sign, but thought of all the signs as one single item. Then Felippe told me that I have to use \n instead to separate the signs and I tried to remove the many blanks, and that's when Inform started to realize that they were 12 items per drowndown, not a single, veeeeeeery long item.

But while trying to remove all those blanks, I forgot to remove those in front of Pisces at the end of the line, so "Pisces" became " Pisces" instead. As my internal calculator checks for "Pisces" instead of " Pisces", it couldn't find any "Pisces", and thus just ignored all the points that were supposed to be added to Pisces.

How did you addItem the blank PRINT lines?

I originally tried to replace the blank PRINT lines with
Code: QB64: [Select]
  1. AddItem Textbox1, ""

When after that change (as part of the other changes in one go mentioned in my last post), the program only crashed when I hit the GO! button, I thought those lines could be responsible and REM'd them out, but it didn't help.

This could have been simply appended to code for GO

I think you're thinking about the program's display output. No, it was inside the drowpdowns where Pisces was borked.

Just added this:
Code: QB64: [Select]
  1. _CLIPBOARD$ = Text(ListBox1)
to the end of the GO button code
_CLIPBOARD$ = Text(ListBox1)

Wow, that's clever! :o

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #38 on: June 12, 2020, 07:41:05 am »
about
Quote
But while trying to remove all those blanks, I forgot to remove those in front of Pisces at the end of the line, so "Pisces" became " Pisces" instead. As my internal calculator checks for "Pisces" instead of " Pisces", it couldn't find any "Pisces", and thus just ignored all the points that were supposed to be added to Pisces.
or in other words the use of string as valute to test
this is the first issue that let me choose , every time that is possible, the tecnique to write CONST numerical with the name of the string... using numerical value for testing let do many tests on it and it is difficult write 13 at the place of 20 , moreover you cannot type " Pisces" at the place of "Pisces" and not recognize the typo error.
Code: QB64: [Select]
  1. CONST  Aries = 1, Taurus = 2,...., Pisces = 12
  2.  
  3.    CASE Aries TO Cancer
  4.       ' the first quadrant
  5.    CASE Taurus, Virgo, Capricorn
  6.         ' the earth signs
  7. ....
  8.  
  9.  

about Camelcase tecnique is great... yes you DIM or CONST a name with a specific letter in uppercase and after in typing code you type always in lowercase, this let you see as soon as a typo error for the name defined first.

Good Coding brings to God's Coding
« Last Edit: June 15, 2020, 11:52:39 am by TempodiBasic »
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #39 on: June 12, 2020, 12:01:06 pm »
Oh Pisces with the space is in the .frm file!

OK changed all those and tested Form by using Pisces where ever it was available along with Tesla's numbers again:
Testing the Download .zip file again, Output to clipboard pasted into Text Editor
Code: QB64: [Select]
  1. Additional astrological calculations based upon the natal chart of
  2.  
  3. born ,,
  4.  
  5.  
  6. Elements:
  7.  
  8. The sum of the water signs in this birth chart is 74. Thus, its owner is determined by the element of water by 92.5%.
  9. The sum of the air signs in this birth chart is 6. Thus, its owner is determined by the element of air by 7.5%.
  10. The sum of the earth signs in this birth chart is 0. Thus, its owner is determined by the element of earth by 0%.
  11. The sum of the fire signs in this birth chart is 0. Thus, its owner is determined by the element of fire by 0%.
  12.  
  13. Dominance of the signs:
  14.  
  15. Strength of Pisces: 74 ( 92.5%)
  16. Strength of Gemini: 6 ( 7.5%)
  17. Strength of Sagittarius: 0 ( 0%)
  18. Strength of Scorpio: 0 ( 0%)
  19. Strength of Aquarius: 0 ( 0%)
  20. Strength of Capricorn: 0 ( 0%)
  21. Strength of Libra: 0 ( 0%)
  22. Strength of Taurus: 0 ( 0%)
  23. Strength of Aries: 0 ( 0%)
  24. Strength of Cancer: 0 ( 0%)
  25. Strength of Virgo: 0 ( 0%)
  26. Strength of Leo: 0 ( 0%)
  27.  
  28. At a strength of 74( 92.5% ), Pisces is the dominant sign.
  29.  
  30. Qualities:
  31.  
  32. The sum of the mutable signs in this birth chart is 74. Thus, its owner is characterized by mutable qualities at 100%.
  33. The sum of the fixed signs in this birth chart is 0. Thus, its owner is characterized by fixed qualities at 0%.
  34. The sum of the cardinal signs in this birth chart is 0. Thus, its owner is characterized by cardinal qualities at 0%.
  35.  
  36. Polarities:
  37.  
  38. The sum of the passive signs in this birth chart is 80. Thus, its owner is characterized by passive polarities at 100%.
  39. The sum of the active signs in this birth chart is 0. Thus, its owner is characterized by active polarities at 0%.
  40.  
  41. Dominance of the houses:
  42.  
  43. Strength of the 3rd house:  35 ( 61.4%)
  44. Strength of the 6th house:  14 ( 24.56%)
  45. Strength of the 9th house:  8 ( 14.04%)
  46. Strength of the 8th house:  0 ( 0%)
  47. Strength of the 10th house:  0 ( 0%)
  48. Strength of the 12th house:  0 ( 0%)
  49. Strength of the 11th house:  0 ( 0%)
  50. Strength of the 4th house:  0 ( 0%)
  51. Strength of the 2nd house:  0 ( 0%)
  52. Strength of the 5th house:  0 ( 0%)
  53. Strength of the 7th house:  0 ( 0%)
  54. Strength of the 1st house:  0 ( 0%)
  55.  
  56. The dominant house in this birth chart is house no. 3( 61.4% ).
  57.  
  58. Dominance of the quadrants:
  59.  
  60. Strength of the 1st quadrant:  35 ( 61.4%)
  61. Strength of the 2nd quadrant:  14 ( 24.56%)
  62. Strength of the 3rd quadrant:  8 ( 14.04%)
  63. Strength of the 4th quadrant:  0 ( 0%)
  64.  
  65. The dominant quadrant is the 1st aka Fire or energy quadrant at  61.4%.
  66.  
  67. For the dominant celestial body in this birth chart, enter its birth place and birth time at www.astro.com and then select the 'Color Oracle'.
  68.  
  69.  

Looks like Pisces is getting counted (but not 100% ? I don't know if this correct as I don't know horoscope functions) and I am learning how to spell Pisces ;-))
Here is updated .zip with all the .frm changes
* HorCalc B+ mod1 revised.zip (Filesize: 94.43 KB, Downloads: 404)
« Last Edit: June 12, 2020, 12:13:12 pm by bplus »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #40 on: June 13, 2020, 06:34:15 am »
@bplus
I have had no time to verify calculation but it is simple, we must compare the result of this program with the result of the other thread tha wa solved.
Programming isn't difficult, only it's  consuming time and coffee

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #41 on: June 15, 2020, 11:05:02 am »
If you wish to copy and paste items from the listbox, just add code to the program to accept a CTRL+C, CTRL+V set of key combos so that when you press CTRL+C AND there is an item selected in the listbox that the item in the listbox is copied to the CLIPBOARD$. Do the opposite for the CTRL+V scenario. Just have it add an item to the listbox from the CLIPBOARD$. I'll post an example here later so you can see what I'm talking about.
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #42 on: June 15, 2020, 04:37:34 pm »
If you wish to copy and paste items from the listbox, just add code to the program to accept a CTRL+C, CTRL+V set of key combos so that when you press CTRL+C AND there is an item selected in the listbox that the item in the listbox is copied to the CLIPBOARD$. Do the opposite for the CTRL+V scenario. Just have it add an item to the listbox from the CLIPBOARD$. I'll post an example here later so you can see what I'm talking about.

Yes that is what I was saying to DDBE, you could do item by item or select a block by selecting top and bottom of it and string all in between in a loop.

I think ListBox is as close as you can get to Text Editor if you don't have one. You can do multiple command buttons and / or textboxes  ie list(1) = "label1 = text value1", ...  (Update) well for that, you do need one TextBox for editing / adding line items in ListBox and a Command button.
« Last Edit: June 15, 2020, 06:41:49 pm by bplus »