Hi Markus - I've been using B4X (mainly B4A, but also some B4J & B4R) for almost 10 years & while I initially started with B4A as part of my first foray into mobile app development, I now find I almost exclusively use Android Studio (Kotlin) & Xcode (Swift) for new development. I even used Unity for one of my apps. I started using Xcode before Erel brought out B4i & when B4i did become available I had learned enough (Obj-C at the time) such that it didn't really make sense to switch.Thanks for the welcome. I'm still undecided if I go for B4 or jump straight to Java. B4 should be easier, but Java is more widespread and potentially more powerful (though I heard you can use Java and ObjC code in B4). My problem is that currently I have no feeling for where the strengths and limitations of B4 are - which is something you need to know when you make a decision.
I gave it as an example of duck typing. Go over the example and you will see that you implement something that is very similar to interfaces in many other programming languages. Just without the interface declaration.But Erel's answer to look at Sophisticated sorting with B4XComparatorSort has me puzzled as it has nothing to do with what I asked. Same happened with his answer to my other question in this thread, so I guess he is currently very distracted / stressed … which given the situation in the outside World would be very understandable.
Another one:I gave it as an example of duck typing.
Ivano, bevi un paio di caffè urgentemente: questo NON è il forum italianoPer le cose complicate ti conviene scrivere nella sezione domanda inglesedove anche @Erel fondatore di questo strumento (gratuito tra l'altro) può darti una possibile,
si vede che sono tornato hahahahahahIvano, bevi un paio di caffè urgentemente: questo NON è il forum italiano
n tanti anni che …
I don't have a nickname - I was Markus Winter on the REALbasic forum, on the Xojo forum, on the IfNotNil forum, and on here, because I believe that if you have something to say then you should (a) tell it to people's faces, (b) put your name to it, and (c) stand by what you are saying.In the many years I have been using realbasic then realstudio and now xojo I don't remember your nick name,
I would have thought the topic was quite clear …however in this whole discussion you ask what?
Germans think they are straight-talking, other nationalities think we are rude. There is a saying that nicely encapsulates that: "The English are too polite to be honest, and the Germans are too honest to be polite".For complicated things it's better to write in the English question section where even @Erel founder of this tool (free by the way) can give you a possible, what I want to tell you is lawful and answer and courtesy. So do not say that the Italian group is not nice, it is grumpyand I say that I broke my balls a year ago to the rhythm of wife scassamaroni (mother-in-law) but it is a good group.
I think they moved over there …no need for an answer it was just a way to tell the Italy group that I'm back to busting my balls
And I thought it is also a bit my fault....Sure do - it's your fault I'm pestering people here … ?
Thanks for the welcome. I'm still undecided if I go for B4 or jump straight to Java. B4 should be easier, but Java is more widespread and potentially more powerful (though I heard you can use Java and ObjC code in B4). My problem is that currently I have no feeling for where the strengths and limitations of B4 are - which is something you need to know when you make a decision.
So I'm going to ask a lot of stupid questions, and as I like teaching might write some tutorials or even a book aimed at beginners like me at some point - and I find comparisons between languages useful as each have their strengths and weaknesses, and the comparisons can teach you a LOT about the language that you might never realise otherwise (eg looking at Swift has changed my whole perspective regarding Xojo - the MapKit alone is as big as the whole of Xojo).
As I learn best when trying to solve a problem, I might just start with one of my many pet ideas and start digging into it.
P.S. Markus with a k - the German spelling
You should know by now that you are guilty by default … so no need to rub it inAnd I thought it is also a bit my fault....
put a finger in the wound so it burns even more... welcome at B4x Forums Markus.You should know by now that you are guilty by default … so no need to rub it in
My apologies if I misunderstood, but on the webpage you simply have a global method defined for comparing objects, and have as an example a string sort OR a person sort in your code. There is no composition shown so of course I couldn't see any.I gave it as an example of duck typing. Go over the example and you will see that you implement something that is very similar to interfaces in many other programming languages. Just without the interface declaration.
B4J Version: 9.30
Parsing code. Error
Error parsing program.
Error description: Unknown type: b4xcomparatorsort
Are you missing a library reference?
instead of having me search for it would have included a linkB4XCollections v1.13 includes a new sorting feature named B4XComparatorSort.
One mantra of mine: don't make thousands of people do the same thing (like searching for the updated library) when you can save that waste of time by doing it just once.B4XCollections v1.13 includes a new sorting feature named B4XComparatorSort.
for each obj as object in myCollection
if obj is a MapLocation then
obj.showOnMap
next
Essere critico va bene purchè sia costruttivo, quando metti un riferimento tipo "interfaccia CanDrawItself" e non metti un codice e come dire "la signora pinco pallo", cioè il nullaNon ho un nickname - ero Markus Winter sul forum REALbasic, sul forum Xojo, sul forum IfNotNil e qui, perché che se hai qualcosa da dire dovrebbe (a) dirlo ai volti delle persone, (b) metteteci il tuo nome e (c ) restate fedeli a ciò che dite.
Sub Class_Globals
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub
public Sub StartEngine()
Log("Engine started")
End Sub
Sub Class_Globals
Dim name As String
Dim myEngine As Engine
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(n As String)
name = n
myEngine.Initialize
End Sub
public Sub TypeOfCar()
Log(name)
End Sub
public Sub SayHello()
Log("Hello, I'm a car")
End Sub
public Sub GetEngine() As Engine
Return myEngine
End Sub
Sub Class_Globals
Dim name As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(n As String)
name = n
End Sub
public Sub SayHello()
Log("Hello, I'm a person")
End Sub
public Sub WhatsMyName()
Log(name)
End Sub
Sub Process_Globals
Dim m As Map
End Sub
Sub AppStart (Args() As String)
m.Initialize
Dim George As Person
George.Initialize("George")
Dim Honda As Car
Honda.Initialize("Honda")
m.Put("George", George)
m.Put("Honda", Honda)
For Each key As String In m.Keys
Dim obj As Object = m.Get(key)
' for a common method, we do not need to cast it
CallSub(obj, "SayHello")
' for a method specific for that class we can cast it if one likes to
If obj Is Person Then
Dim pers As Person = obj
pers.WhatsMyName
End If
If obj Is Car Then
Dim ca As Car = obj
ca.TypeOfCar
End If
' this would also work
If obj Is Person Then
CallSub(obj, "WhatsMyName")
End If
If obj Is Car Then
CallSub(obj, "TypeOfCar")
End If
' if the class has an engine. If 'GetEngine' does not exists (like with a person), Eng will be null.
Dim Eng As Engine = CallSub(obj, "GetEngine")
If Eng <> Null Then
' the object has an engine, so start it
Eng.StartEngine
End If
Next
End Sub
If obj Is Car Then
Dim ca As Car = obj
ca.myEngine.StartEngine
End If
For each key as String in myCollection.Keys
Dim obj as Object = myCollection.get(Key)
If obj is MapLocation then
Dim ml as MapCollection = Obj
ml.showOnMap
End If
Next
' or even, as it will only run the mehod showOnMap if it exists
For each key as String in myCollection.Keys
Dim obj as Object = myCollection.get(Key)
CallSub(obj, "showOnMap")
Next
Ah - silly me. Works now. Needed the updated B4XCollections.b4xlib. Would have been useful if
instead of having me search for it would have included a linkB4XCollections v1.13 includes a new sorting feature named B4XComparatorSort.
B4XCollections v1.13 includes a new sorting feature named B4XComparatorSort.
Come on now, you've been a part of the forum for ten years. Surely you understand this is the english part of the forum.Essere critico va bene purchè sia costruttivo
certo che lo so ma volevo una critica, poi con il tasto dx scegli la lingua che più di piace ;-)Forza, fai parte del forum da dieci anni. Sicuramente capisci che questa è la parte inglese del forum.
In my understanding he wanted to show why he needs to go away from Xojo and wants to move to B4x. Yes, it is a weird way to do it but...it is like it is. We can support to help ro find the needed connections to have the needed entrance. I believe that critics never helping when there is no solution.even after three great ? holidays times in Italy and a mother-in-law who knows nothing about comput
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?