I spent the whole night to convert a C#-Project to Xojo. That works quite well, but there are hurdles final, which I do not know how to eliminate. I would be pleased, if you do once looking at the source code. it is not much. Once you want to compile, the debugger displays the flaws. I have the C # project also added to the dropbox, then you can better compare.
The program shown is built with Visual Studio. After lots of code transposition, Martin is asking for help I believe in making his translation work with Xojo. I haven’t looked at the code itself but I’d imagine some problems lay within translating point apis to Xojo graphics conversion. Xojo and C# handle drawing much differently (end-user-wise). IMO, it would take much less code to rewrite a hierarchy drawing scheme from scratch with Xojo alone, than transposing verbatim C# methods to Xojo methods.
For instance, you know in the top level (maybe use an array of arrays…“Array Pyramid”), has 1 block of 2, the next will have 2 for each block in the previous, so on and so forth. Determine the block height needed as well as verticle spacing and horizontal spacing for drawing the blocks. Draw the blocks, insert the images, and draw the connecting lines. I’ll see mid-day today if I can’t write a simple solution for you. What I’ve outlined should take about 20 minutes. I’ll be back. Work calls.
Hi David, yes it should work on Mac, because it’s my Developement-Engine
[quote=202515:@Matthew Combatti]The program shown is built with Visual Studio. After lots of code transposition, Martin is asking for help I believe in making his translation work with Xojo. I haven’t looked at the code itself but I’d imagine some problems lay within translating point apis to Xojo graphics conversion. Xojo and C# handle drawing much differently (end-user-wise). IMO, it would take much less code to rewrite a hierarchy drawing scheme from scratch with Xojo alone, than transposing verbatim C# methods to Xojo methods.
For instance, you know in the top level (maybe use an array of arrays…“Array Pyramid”), has 1 block of 2, the next will have 2 for each block in the previous, so on and so forth. Determine the block height needed as well as verticle spacing and horizontal spacing for drawing the blocks. Draw the blocks, insert the images, and draw the connecting lines. I’ll see mid-day today if I can’t write a simple solution for you. What I’ve outlined should take about 20 minutes. I’ll be back. Work calls.[/quote]
Hi Matthew, nope i decided to do this, because the C#-Source looks very good for a Translation take a look, when your work is over.
Translating a language to another requires a good understanding of both the source language, and the target one. In particular, it requires understanding the logic of the program to be able to port it under another language (here Xojo) where classes, methods and properties may quite different from C#.
In this instance, it looks as if the posted project has halted because the word for word translation reached its limits. That is where Xojo development should have taken place. The number of errors show a grave lack of understanding of the logic involved.
Ignorance is no sin, and indeed programming is often learning by doing. But here, the OP may have tried to chew more than he could bite.
Someone else may be able to fix the ill formed baby. But giving the nature of the errors, that probably would require a huge effort.
Maybe a more worthwhile endeavour and learning experience would be to develop a pure Xojo program from the layout up…
[quote=202591:@Michel Bujardet]Translating a language to another requires a good understanding of both the source language, and the target one. In particular, it requires understanding the logic of the program to be able to port it under another language (here Xojo) where classes, methods and properties may quite different from C#.
In this instance, it looks as if the posted project has halted because the word for word translation reached its limits. That is where Xojo development should have taken place. The number of errors show a grave lack of understanding of the logic involved.
Ignorance is no sin, and indeed programming is often learning by doing. But here, the OP may have tried to chew more than he could bite.
Someone else may be able to fix the ill formed baby. But giving the nature of the errors, that probably would require a huge effort.
Maybe a more worthwhile endeavour and learning experience would be to develop a pure Xojo program from the layout up…[/quote]
Sure, you are right. I know that such a thing is a complex task. But i need “Input”. Thats why i asked.
I work with c# and I agree with what people are saying, don’t try and convert the code, I’ve done my vb.net and c# projects in Xojo but I’ve done them all from scratch, as long as you know how it works in the first place its actually quite easy, there’s usually a better way to achieve the same thing
I did look closely at your project. If I was to try and make it work, it would take an enormous amount of work simply to read carefully the source in C# until I am confident I understand the structure of the program, and get my head around the logic.
Then it is possible, but not certain, that I could spot where the present project fails and fix it.
You see, there is a world of difference between transposing one single method, or a couple ones, and a whole project. As complexity grows, so do debugging difficulties. The issue is not so much languages, as complexity. But when you kind of carbon copy a program you have not written, overlooking the simplest detail creates bugs that become extremely difficult to understand.
I have the feeling that now, as you have done all that work, it may take you much less time to build the program entirely in Xojo from the ground up. You already have in mind the structure of the UI, and can probably reuse the methods that are self-contained. That should be a rather easy task.
an you can put thes in paper sheets. Once youve done, you may be able to write it from scratch (and probably reuse the methods that are self-contained) in a very short time.
Before reaching (I get the info from Apple) REALbasic, back in early 1999, I was using another development environment. I started to have troubles in the development and at a moment I was unable to continue due to bugs.
When I get to know about REALbasic, I downloaded the then current alpha and started my application from the blank paper sheet, but having in mind how to do it and in a folder all the multimedia data I needed. It does not took me long time to be on pair with the previous project (that does not worked anymore), and then expand it far away from his ancestor
OK: I was younger (17 years ago), my memory rocked (vs today), etc., but you get the idea.
I spent the whole night to convert a C#-Project to Xojo. That works quite well, but there are hurdles final, which I do not know how to eliminate. I would be pleased, if you do once looking at the source code. it is not much. Once you want to compile, the debugger displays the flaws. I have the C # project also added to the dropbox, then you can better compare.
Some Days ago,
i got some input of other Coders. Here is a sample for the 4 Generation Family Tree (the whole FamilyTree ist the class called SelectedPersonViewModel), i want to create:
In the 3. Generation (Siblings and Proband), the EngagedTo-Property of the Siblings shows us the spouses of each of the siblings.
Analog in the 4. Generation, they show us Partner of the Children of the Proband.
And here are the Structure:
At this point, i only wanna draw the Persons without the Busses between the Persons. Each one should be clickable. Thats why i thought i can realize it like the code of Eugene Dakins “I Wish I Knew How To…Program the Canvas Control with Xojo Desktop” (Chapter 7 - Objects). But the thing is, i will have different Objects, some of them create other Objects within themselves. So, how can i get the actual Object via MouseMove over the Canvas?
The width of the FamilyTree is dynamic. I have to figure out the Width by the count of the Children, Siblings, Spouses…and i have to compare them to set the right width and Height.
i made some more experiences with my Family Tree. I decided to go step by step. I made a Tree Structure to show max. 4 Generations:
Generation: [Grandparents]
Generation: [Parents]
Generation: Proband [Spouses]
Generation: [Children]
*[] means optional entries
At the moment i work on the Proband and Spouses (internal 3. Generation, but 1. Generation). The graphical Output should look like this:
But i will get this:
As you can see, the Names and the ID’s of the Spouses will drawn correctly, but not the Background-Roundrects. I took a look at my draw-Method of vcPerson, but i can’t find the Error (setting the right Coordinates). Would be great if you can have a look up to my source
Edit: I’m also looking forward to scroll the Canvas, if the pBuffer ist bigger then the Canvas, but i don’t wanna lost the Mouse-Hover Functionality. How to handle that?
I was unable to download the project file from dropbox, it was giving me an error. Just by the look of it, It seems that maybe the x and y are swapped for the position of the background boxes.
I don’t know, what you mean. It’s a normal Xojo-Binary-Projectf File! I have no problems to download it I created another Download-Link: FamilyTree Project
[quote=209647:@Scott Siegrist]In “draw” method of vcPerson class, change
g.FillRoundRect Top, Left, Width, Height, 12, 12
to
g.FillRoundRect Left, Top, Width, Height, 12, 12
Thank you Scott, very simple
How would you handle the Scrollbar-Thing?
Pseudo-Code
// calculate the pBuffer.Width
pBuffer.Width = Proband.Width + (Spouses.Ubound * Spouse.Width) + ((Spouses.Ubound - 1) * Margin)
if pBuffer.Width > Canvas.Width then showScrollbar // analog in vertical Direction
First of all i implemented the main ideas for the component. Each Item b[/b] has the following properties:
ZoomFactor
Left, Top, Width, Height
Name
Type (at the moment: Proband and Spouse, just as samples)
Every PersonViewModel will be drawn at a Canvas (works). Also the Zoom. I also got the Person under the Mouse, but only, if the ZoomFactor is 1.0. What will i need to change, that the ElementHit-Function at Window1 will also works fine with other ZoomFactors? This will show only the Basic Functions of a PersonViewModel!
Link to the Sample-Project: Family Tree with Zoom