Hello world on a report
Posted
#1
(In Topic #369)
Enthusiast

No fancy data base or books …. just a simple one page Report with a line or two of text and a graphic
Posted
Guru

This is how I got here: -
1/. Start a new Graphical Application
2/. Add the component gb.report2
3/. Right click on FMain > New > Report
4/. Delete FMain
5/. Make Report1 the startup class
You will then have a new Report Form to work with. I played with this to get: -
…. just a simple one page Report with a line or two of text and a graphic
No code needed to get this far. What do you want to do with it? I'd be interested to know how you get on.
<IMG src="http://www.cogier.com/gambas/Report1.png">
</IMG>
Posted
Enthusiast

Also should I be converting the String array "checkingaccountdata[ ]" to a class ?
The following will print 3 check on blank check paper.
Code (gambas)
- Paint.DrawRichText("<Font Color= blue>" & checkingaccountdata[custname], 3400, 300 + offset)
- Paint.DrawRichText(checknumber, 8000, 300 + offset)
- Paint.DrawText(checkingaccountdata[custaddress], 3400, 500 + offset)
- Paint.DrawText(checkingaccountdata[custaddress2], 3400, 700 + offset)
- Paint.DrawrichText("<h2>$</h2>", 7800, 1160 + offset)
- Paint.DrawRichText(checkingaccountdata[bankname], 3400, 1900 + offset)
- Paint.DrawRichText("< small >" & checkingaccountdata[bankinfo1] & "< / small >", 3400, 2100 + offset)
- Paint.DrawRichText("< small >" & checkingaccountdata[bankinfo2] & "< / small >", 3400, 2250 + offset)
- Paint.DrawText("a" & checkingaccountdata[routingnumber] & "a " & checkingaccountdata[accountNumber] & "c " & checknumber, 3100, 2960 + offset)
- checknumber -= numberofPages
- checknumber += (numberofPages * 3) - 1
Posted
Guru

The code you provided is not complete so I could not see exactly what you are trying to do. Have you spelt the font 'Aeral' correctly, should it not be 'Arial'?
I don't see why you have to make a class for an array but again if you could upload a program we can run, that would help.
Posted
Enthusiast

I looks like the report module is not going to do what I wanted, but i will keep looking at it.
I would like feedback on my program, don't be afraid to insult me, I have a thick skin.
attached is the complete program
Posted
Guru

Changes: -
Form now fully expandable
Values can now be changed by rotating the mouse wheel.
Picture works better (Suggest you don't use 'Stretch' but the 'Mode' option instead. I updated the help on this here)
'Quit' is not recommended see here. Use 'Me.Close' instead.
I was changing the TextBox text and moving to the next with the 'Tab' key. This meant the data was not updating as I did not use the enter key. It took me sometime to work this out. I have added a routine "Update" to update the array before saving.
I have made several changes to the Load and Save routines, your 'Home' may be "mhc" but mine is not. You need to use 'User.Home' to solve this issue.
There is no need to use 'Blah & "/" & Blah' use '&/' instead it will work out if you need a "/" or not.
I hope this all helps.
<IMG src="http://www.cogier.com/gambas/BankInfo1.png">
</IMG>
Posted
Enthusiast

I now understand what the spring does
There is so much to learn between the system and the language that it is daunting for me.
I have been trying to grasp the concept of OOP … I realize that Gambas is not a true OOP language But:
If I wanted to change the String[] array to an object or class, (as a learning experience) can you suggest how to do that and what is the syntax ?
Posted
Regular

grayghost4 said
…I have been trying to grasp the concept of OOP … If I wanted to change the String[] array to an object or class, (as a learning experience) can you suggest how to do that and what is the syntax ?
I don't really understand your question regarding String[], so sorry if I misunderstand.
String[] is really already a class, which you can use to create a new instance of itself as an Object;
So now that aSomeText is a new object based on the String[] class, you can use its properties:-
Code (gambas)
- aSomeText[0] = "BWM"
- aSomeText[1] = "Chevrolet"
- aSomeText[2] = "Jaguar"
…and you can use its Methods to do stuff like:-
Posted
Guru

If I wanted to change the String[] array to an object or class, (as a learning experience) can you suggest how to do that and what is the syntax ?
I'm with Steve on this as well. The interesting thing about your array is that you don't need it. I have been messing again and reduced the code considerably.
The array was storing the data in your TextBoxes and SpinBoxes, however, the TextBoxes and SpinBoxes are already storing the data so in this version instead of referring to Array[9] I have just gone to the TextBox and got the information from there.
There is no need to check if the cheque number (Sorry UK spelling) is less that 1 as the SpinBox is set not to go less that 1 (less code)
As all the TextBoxes in this program are now in a VBox a simple 'For each…' loop will get the data from each TextBox to save.
I have also put the 'Graphics' in a ComboBox to make things easier.
NOTE. The order of the saved data is in a different order than your original, the cheque number is now last.
I have tested this code and it seems to work OK but please test it yourself before putting it into use.
Posted
Enthusiast

Looks like lot of new techniques to learn, it is time to start over with this program from scratch.
If I just take your code and use it … I have not learned anything … I have to use your suggestion and implement them myself.
This is a good learning project to learn the language and GUI
Posted
Regular

grayghost4 said
…If I just take your code and use it … I have not learned anything … I have to use your suggestion and implement them myself…
Yes, that's definitely the right attitude.
Posted
Enthusiast

But with your help I have been able to finish my check program and in the process learn a lot
I have posted the program again for comments and maybe someone else will learn some of the things I learned.
Thanks again to those that help !
Posted
Guru

In the program the comma is a problem as you are using it as a Split Separator, consider saving with NewLines or my favourite character for this sort of thing "`". It's on the left of the "1" key on your keyboard, I have no idea what it is designed for. So now no need to worry about commas.
Code
Samplebankofamerica,Mrs. Jone Smith ,1234 Main Street (555)123-7654,Home Town State Zipcode,0789000231,084332167,bankofamerica.jpg,23459Code
Samplebankofamerica`Mrs. Jone Smith `1234 Main Street (555)123-7654`Home Town State Zipcode`0789000231`084332167`bankofamerica.jpg`23459Then use Split(Text,"`") to get your data.
If you have a load of TextBoxes, as in this case, you can give then the same Group name e.g. AllTextBoxes. This means that an event on any of the TextBoxes will be directed to one routine e.g. AllTextBoxes_Change(). You can use the Last keyword which holds all the data of the TextBox last used. Have a look at the 8 routines I have reduced to 1 in the attached.
You could use a ValueBox that only takes numbers and make the other change above and you could remove that routine as well.
Posted
Enthusiast

Also thanks for the hint to the use of the Group uses , but I have assinged just the number fields to "NumberBoxes" and I like the code below , I think it is easer to read and self explanatory.
Code (gambas)
I will try switching them to value boxes.
1 guest and 0 members have just viewed this.


