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

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #15 on: June 10, 2020, 04:47:52 am »
Hi DDBE
sorry for my raw question...
Do you have any experience of event driven programming?
As you said the VB course has give to you very few informations.
Inform need to think in this kind of programming.
my suggestion is
1.
Please make a separate SUB into paste your code to calculate the dominance as you have done for Quicksort and Display. You can call it just typing under SELECT CASE iditem of __UI_Click (id item) the call to the SUBroutine
here an example
Code: QB64: [Select]
  1. SUB __UI_Click (id AS LONG)
  2.  
  3.   CASE button1
  4.        Calculation
  5.  
  6. ....
  7.  
  8. SUB Calculation
  9.  
  10.  
  11.  sun$ = GetItem$(DropdownList_sunSign, Control(DropdownList_sunSign).Value)
  12.             sun_House = VAL(GetItem$(DropdownList_sunHouse, Control(DropdownList_sunHouse).Value))
  13.             moon$ = GetItem$(DropdownList_moonSign, Control(DropdownList_moonSign).Value)
  14.             moon_House = VAL(GetItem$(DropdownList_moonHouse, Control(DropdownList_moonHouse).Value))
  15.             ascendent$ = GetItem$(DropdownList_ascendantSign, Control(DropdownList_ascendantSign).Value)
  16.             'MC$ = VAL(GetItem$(DropdownList_MCSign, Control(DropdownList_MCSign).Value))
  17.             mercury$ = GetItem$(DropdownList_mercuryHouse, Control(DropdownList_mercuryHouse).Value)
  18.  
  19. ....
  20.  

2.
please cancel every PRINT statement if you want a more window style output

3.
to give instructions to user you can use the old way to make a splashscreen ( a separate window that gives informations to use the program) or the more suitable Tooltip property of each component of window of your program.
https://github.com/FellippeHeitor/InForm/wiki/Tool-tip

but
going to your state of developing your project....
1. is your project a simple calculator ?
2. Do you like  the manual entry data  or also a direct input from clipboard or file or string ?
(Here I call Entry data the position of the planets in the astrological chart that you specify Sun in Taurus and 1 house Moon in Gemini and 10 house .....)
3. do you want to bring to clipboard all the informations calculated or just any of them?
 3.1 Do you need of clipboard or you can use a file temporary to pass information in text format?

Is this a step to draw and print on paper or on file image the native astrological chart?
I hope that you have traced a path before starting this adventure and you aren't going on only by attempts  because it is an ambitiouse goal so please
First projecting Second verifying Third typing code... so if a language or your skill in that language is not enough you can port your idea anywhere!  ;)
But moreover you can use the help of this community in constructive manner.

PS statement at line 117 is an absurdum because that is the click event and must be activate when there is a click in the window of program, there is no reason to hack its calling in this manner, to activate that sub _Event simply click on the button!  If it doesn't work it is clear that you have messed the nameId of components so the GOpart1 is not button1. If you know the ID name of your component you must open the box of .FRM file and search into it for the buttons items and write somewhere these names that you must use in SUB event to manage the actions activated by these components.

Good Luck
 in Event Driven Programming

Programming isn't difficult, only it's  consuming time and coffee

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #16 on: June 10, 2020, 12:28:08 pm »
Guys, I'm sorry for how grumpy I've been before I went to bed due to how tired and frustrated I was.

Hi DDBE
sorry for my raw question...
Do you have any experience of event driven programming?
As you said the VB course has give to you very few informations.
Inform need to think in this kind of programming.

As said, I still have a hard time wrapping my mind around event-based programming. I've already told Fellippe in a PM over on Discord that that's why I don't seem to be able to call up sub-routines in this new InForm-generated code. Whenever I tried, I only got syntax errors.

Code: QB64: [Select]
  1. SUB __UI_Click (id AS LONG)
  2.  
  3.   CASE button1
  4.        Calculation
  5.  
  6. ....
  7.  
  8. SUB Calculation
  9.  
  10.  
  11.  sun$ = GetItem$(DropdownList_sunSign, Control(DropdownList_sunSign).Value)
  12.             sun_House = VAL(GetItem$(DropdownList_sunHouse, Control(DropdownList_sunHouse).Value))
  13.             moon$ = GetItem$(DropdownList_moonSign, Control(DropdownList_moonSign).Value)
  14.             moon_House = VAL(GetItem$(DropdownList_moonHouse, Control(DropdownList_moonHouse).Value))
  15.             ascendent$ = GetItem$(DropdownList_ascendantSign, Control(DropdownList_ascendantSign).Value)
  16.             'MC$ = VAL(GetItem$(DropdownList_MCSign, Control(DropdownList_MCSign).Value))
  17.             mercury$ = GetItem$(DropdownList_mercuryHouse, Control(DropdownList_mercuryHouse).Value)
  18.  
  19. ....
  20.  

Oh, one thing I forgot to mention before I went to bed. As you can see I've kinda REM'd out the line for the MC for the time being, as that was also giving me an error for some reason.

please cancel every PRINT statement if you want a more window style output

Oh, duh! I was so stupid!

going to your state of developing your project....
1. is your project a simple calculator ?

Um...I guess it is.

Is this a step to draw and print on paper or on file image the native astrological chart?

Oh, no, no! The basic idea is that you already have received a chart from elsewhere, a website such as www.astro.com or www.astroschmid.ch. Thing is, as I've written in my very first pastebins before I joined the forums, those websites don't tell you *EVERYTHING* that can be interpreted or calculated from that chart. Thus, the user would take a chart they've received from a place such as www.astro.com and www.astroschmid.ch to calculate some additional stuff by inputting the positions of the planets from the pre-existing chart into my program that will calculate six different dominances for them. Those dominances mean additional things in astrology that the user can then look up.

For example, if the 4th house is somebody's dominant house, you can look up external websites to see that it means they are a homely person who like their family, have few, but very close friends, and they like to retreat into their own house or apartment. If their dominant element is water, you can look up other websites and see that it means they are passive, emotional, and sensitive.

That's the idea behind this calculator: Take a chart that you have received from elsewhere and use my program to calculate dominances of various categories or factors to look up elsewhere what these dominances mean. Most of all, I want to be able to copy the program's output to write up other people's birth horoscope in Open Office.
« Last Edit: June 10, 2020, 01:43:29 pm 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 #17 on: June 10, 2020, 04:41:56 pm »
Quote
Guys, I'm sorry for how grumpy I've been before I went to bed due to how tired and frustrated I was.

Man I've been there many times, but nice how you forget all that when it finally works the way you imagined.

When you said 27 hours straight, yikes! Kind of shamed me into making 2nd effort on my Gin Rummy variations and maybe had break through today, we'll see. ;-))

Hang in there, you've got a rather ambitious project for a first InForm attempt. Maybe not 27 hours again, but I know when you stop and start and stop ... you waste time getting up to speed to where you left off. I am big fan of one day projects :)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #18 on: June 10, 2020, 06:33:58 pm »
oh friend don't mind up, step by step you'll reach the goal! What I's saying you  is be aware to make a path to arrive at your goal so you'll know that each step made is in the right direction.

If you post the .frm file we can get out the ID of each component.

Please say me, because I haven't understood this: Why do you put 2 buttons GO? In your SCREEN0 program there is one massive calculation.

Programming isn't difficult, only it's  consuming time and coffee

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #19 on: June 10, 2020, 07:46:34 pm »
Please say me, because I haven't understood this: Why do you put 2 buttons GO? In your SCREEN0 program there is one massive calculation.

Oh, those two buttons are no longer part of the form anymore. They originally came about when Felippe told me to use a multi-line, but non-scrollable label for the output. The space available for that label would not have been enough for *ALL* of the program's output, so I decided to use two buttons to first output the first half, then output the second half.

But then bplus said I could be using a ListBox instead of a label for the output, as a ListBox is scrollable (and I thought he'd also meant that the output could be copy-pasted, but now it seems that's not possible, albeit I haven't been able to click on that one button yet to see what's true about a ListBox and what is not).

If you post the .frm file we can get out the ID of each component.

Okay, I'm attaching the current .bas and .frm at the bottom of this post. As you can see, I've been a little sneaky and tried to fix the fact that I forgot to remove the caption *INSIDE* of the textboxes at the top of the window, by means of then using SETCAPTION inside the .bas to remove the caption.

As said in my last post, assigning the MC$ value doesn't seem to be working yet.
* Horoscope calculator.bas (Filesize: 78.84 KB, Downloads: 309)
* Horoscope calculator.frm (Filesize: 41.66 KB, Downloads: 274)
« Last Edit: June 10, 2020, 07:48:47 pm by DDBE »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #20 on: June 10, 2020, 08:20:53 pm »
@DDBE
I'll take a look into your files tomorrow.

for now about this your question

Quote
As said in my last post, assigning the MC$ value doesn't seem to be working yet.
I think that you are wrongly using VAL because you are using VAL to get the number of the house in which the planet is, but as you have explain to me
Quote
One only needs to remember that ascendant and MC themselves don't add to a specific house, because unlike with celestial bodies, their position within the house sytem is fixed by being the boundary between the 12th and the 1st house (the ascendant, always located at roughly 9 o'clock on the circular chart) and between the 9th and the 10th house (the MC, always located at roughly 12 o'clock).
So like for ascendant$ in the same manner for MC$ you must get the data .
No this
Code: QB64: [Select]
  1.             ascendent$ = GetItem$(DropdownList_ascendantSign, Control(DropdownList_ascendantSign).Value)
  2.             'MC$ = VAL(GetItem$(DropdownList_MCSign, Control(DropdownList_MCSign).Value))

but this one
Code: QB64: [Select]
  1.             ascendent$ = GetItem$(DropdownList_ascendantSign, Control(DropdownList_ascendantSign).Value)
  2.             MC$ = GetItem$(DropdownList_MCSign, Control(DropdownList_MCSign).Value)
let me know.
Programming isn't difficult, only it's  consuming time and coffee

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #21 on: June 10, 2020, 08:43:59 pm »
D'oh! It's what you get for simply copying the first two lines of that block and then pasting them over and over, only changing the addressed dropdown.

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 #22 on: June 11, 2020, 11:19:41 am »
@DDBE

Tried your InForm files but missing the InForm sub-folder.

I have older InForm but there appears to be a version error, my Inform sub-folder is wrong version , so I need the whole inForm package or something to translate the .frm file correctly.

@FellippeHeitor  left some notes somewhere about distributing InForm app packages into one handy zip. That might be a post to pin up. I can see this problem popping up often.

« Last Edit: June 11, 2020, 11:23:06 am by bplus »

FellippeHeitor

  • Guest
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #23 on: June 11, 2020, 11:23:12 am »
Here https://www.qb64.org/forum/index.php?topic=1878.0

It's pinned at the top of the 'InForm-based programs' board, should you guys need to refer back to it.

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 #24 on: June 11, 2020, 11:25:14 am »
Oh it's pinned up under InForm Programs Child-Board good! Thanks Fellippe
« Last Edit: June 11, 2020, 12:04:16 pm by bplus »

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #25 on: June 11, 2020, 01:44:55 pm »
Okay, second try at uploading.
* HorCalc.zip (Filesize: 88.95 KB, Downloads: 288)

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 #26 on: June 11, 2020, 02:32:53 pm »
Hi @DDBE,

Ah good! Everything loads properly no errors from IDE after load.

Had to remove END on line 117 to see Form otherwise nothing happens when run it.

Wow! That's one big Input Form!!!

Good the GO button does load the array into the List box, fortunately it's at the bottom of screen that is higher than my laptop screen but I can scroll through items in list box.

Is there any other controls under the list box? Or am I seeing all I need at the bottom of my laptop screen? (Again I can't see the bottom of the form.)

So it looks like not all the information is getting passed to the array from the looks of the List box, allot of 0's.
I've got to review how to get contents out of textbox. Maybe I have to add info to textboxes, is there a default set of info already in there?

Ehh, can't access bottom scroller so can't see bottom of list.

OK I did Tempodi's suggested fix for MC$ and just plugged in a bunch of random data and the 0's go away, so it functions... yeah?
Code: QB64: [Select]
  1.  MC$ = GetItem$(DropdownList_MCSign, Control(DropdownList_MCSign).Value) '                                  fix as per TempodiBasic

Looking good so far, right?

OK reminder, you can't multi-select from Listbox as I recall, but you can select a top item and then select a bottom item save those indexes and then create a block of text from top to bottom that you can paste into Clipboard as I have demo'd in link to Text Fetch, my app with tiny Navigator to clip text out of text files from anywhere on hard drive.
« Last Edit: June 11, 2020, 03:01:32 pm by bplus »

FellippeHeitor

  • Guest
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #27 on: June 11, 2020, 03:29:47 pm »
ListBox controls store items in the Text() array, separated by CHR$(10). Want to copy all the contents of a list called ListBox1 to the clipboard, just do:

Code: QB64: [Select]
  1. _CLIPBOARD$ = Text(ListBox1)

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 #28 on: June 11, 2020, 04:07:21 pm »
ListBox controls store items in the Text() array, separated by CHR$(10). Want to copy all the contents of a list called ListBox1 to the clipboard, just do:

Code: QB64: [Select]
  1. _CLIPBOARD$ = Text(ListBox1)

Yeah that's easy, but I get impression DDBE wanted to do parts of the whole text block like we can do with mouse selecting from code here at forum for example.

I am saying you can get selections of a whole, a text block at a time by selecting top line from list box and then bottom line then tie those lines together and get another block if wanted...

Or hey, just select a line at a time and string all those selections together for clipboard, just keep adding them on... until you have want you want in clipboard.

Offline DDBE

  • Newbie
  • Posts: 26
    • View Profile
Re: How to work with dynamic, Excel-style $tring tables in InForm?
« Reply #29 on: June 11, 2020, 05:28:15 pm »
Is there any other controls under the list box? Or am I seeing all I need at the bottom of my laptop screen? (Again I can't see the bottom of the form.)

So far, there are no other controls besides the one GO! button.

ListBox controls store items in the Text() array, separated by CHR$(10). Want to copy all the contents of a list called ListBox1 to the clipboard, just do:

Code: QB64: [Select]
  1. _CLIPBOARD$ = Text(ListBox1)

Well, if that's the easiest way, we can simply shrink the GO! button again and put a simple Copy button below it. I priorly preferred to do it by means of selecting by mouse as I can directly see what I'm copying via the selection color, but as said, if it's easier coding-wise, we can also use a Copy button to copy the entire list to the clipboard.