Bug Report: Arithmetic operations
Hi Manuel,
Wow this is great to be able to compile into Java for the first time.
I note that arithmetic operations using a carat mark such as
msgbox( 3^2 + 7)
or
msgbox( 7 + 3^2)
ARE supported, but give the WRONG ANSWER. Both should give 16, but the first gives a real number larger than 1000 and the second gives the integer 100.
------------------------------------------------------------------------------------------
Secondly, it is annoying but it keeps asking the resources to be relocated, it will say it cannot find the field "bitmap.gif" and when I browse to it again it will create a new file "bitmap2.gif." Next run it cannot find "bitmap2.gif" so it creates "bitmap3.gif" and so-on. It seems often unable to recognize that resourcse are there. This is running in Vista.
John
Amazing piece of software, you must have good people who helped you create this
Wow this is great to be able to compile into Java for the first time.
I note that arithmetic operations using a carat mark such as
msgbox( 3^2 + 7)
or
msgbox( 7 + 3^2)
ARE supported, but give the WRONG ANSWER. Both should give 16, but the first gives a real number larger than 1000 and the second gives the integer 100.
------------------------------------------------------------------------------------------
Secondly, it is annoying but it keeps asking the resources to be relocated, it will say it cannot find the field "bitmap.gif" and when I browse to it again it will create a new file "bitmap2.gif." Next run it cannot find "bitmap2.gif" so it creates "bitmap3.gif" and so-on. It seems often unable to recognize that resourcse are there. This is running in Vista.
John
Amazing piece of software, you must have good people who helped you create this
Operator Priorities
Hi,
this seems to be a problem of arithmetic operator priorities.
If you use brackets, you get the correct results:
msgbox( (3^2) + 7)
msgbox( 7 + (3^2))
Currently, Jabaco is evaluating the following instead:
msgbox( 3^(2 + 7))
msgbox( (7 + 3)^2)
So, the error is that the priority of "^" is equal to that of "+". It should be higher.
Cheers!
A1880
this seems to be a problem of arithmetic operator priorities.
If you use brackets, you get the correct results:
msgbox( (3^2) + 7)
msgbox( 7 + (3^2))
Currently, Jabaco is evaluating the following instead:
msgbox( 3^(2 + 7))
msgbox( (7 + 3)^2)
So, the error is that the priority of "^" is equal to that of "+". It should be higher.
Cheers!
A1880
This post has been edited 1 times, last edit by "A1880" (Mar 25th 2009, 11:50pm)
Thank you. I forgot to set the priority for "^"
Quoted
ARE supported, but give the WRONG ANSWER. Both should give 16, but the first gives a real number larger than 1000 and the second gives the integer 100.
Quoted
So, the error is that the priority of "^" is equal to that of "+". It should be higher.
Could you specify the steps to reproduce this problem?
Quoted
Secondly, it is annoying but it keeps asking the resources to be relocated, it will say it cannot find the field "bitmap.gif" and when I browse to it again it will create a new file "bitmap2.gif." Next run it cannot find "bitmap2.gif" so it creates "bitmap3.gif" and so-on. It seems often unable to recognize that resourcse are there. This is running in Vista.
Hi Manuel, Hi John,
did you see this:
Resources
there is another trap, due to a bug in Jabaco.
To avoid this behaviour follow these steps:
* copy all your resources you want to integrate in your Jabaco project to a folder beside
or outside of your Jabaco project folder
* in Jabaco, open your jabaco project and delete alle resources from the project
save the project and close Jabaco
* in the folder of your jabaco project delete all resources and if there is a res-directory delete this
res-directory from your project folder.
* restart Jabaco with your project, and load the resources from the folder outside of your
jabaco project.
explanation:
Jabaco has problems if the resource-file that you want to integrate and open as a resource, already exists in your project folder or in the res folder.
greetings
OlimilO
did you see this:
Resources
there is another trap, due to a bug in Jabaco.
To avoid this behaviour follow these steps:
* copy all your resources you want to integrate in your Jabaco project to a folder beside
or outside of your Jabaco project folder
* in Jabaco, open your jabaco project and delete alle resources from the project
save the project and close Jabaco
* in the folder of your jabaco project delete all resources and if there is a res-directory delete this
res-directory from your project folder.
* restart Jabaco with your project, and load the resources from the folder outside of your
jabaco project.
explanation:
Jabaco has problems if the resource-file that you want to integrate and open as a resource, already exists in your project folder or in the res folder.
greetings
OlimilO
This post has been edited 2 times, last edit by "OlimilO" (Mar 24th 2009, 9:10pm)
Wow, thanks for the fast response! That explains both behaviors. Also...
Wow, thanks for the fast response. That explains both behaviours (priority of operations and the way Jabaco prefers to keep application folders separate).
Two other very small things:
1) I am trying three ways to make the form backcolor completely transparent (so I can use a gif to make the form another shape besides square. None of these work:
- setting the background color programmatically to rgb(0,0,0,0) with 0 for alpha as the last entry
- trying to access java#awt#color
- setting transparent to 0 in the form properties box.
I also tried decompiling some of the java class files.
2) What event fires when a form is unloaded (closed)? What if a user for instance wants to do actions when the user closees a form? Should I read an existing page here to figure that out?
JM
Two other very small things:
1) I am trying three ways to make the form backcolor completely transparent (so I can use a gif to make the form another shape besides square. None of these work:
- setting the background color programmatically to rgb(0,0,0,0) with 0 for alpha as the last entry
- trying to access java#awt#color
- setting transparent to 0 in the form properties box.
I also tried decompiling some of the java class files.
2) What event fires when a form is unloaded (closed)? What if a user for instance wants to do actions when the user closees a form? Should I read an existing page here to figure that out?
JM
Form exit
Hi,
a "Form" inherits from class "AbstractForm".
In the source of AbstractForm you can find:
This method is called by default in "Module1" of a standard Jabaco project:
If you comment out (or leave out) the line "Form1.SetDefaultClose()" a user abort will cause an event you can intercept:
Well, for me it would be nicer to have a more VB6 like situation. So my suggestion would be to add an unload event for Forms in the Jabaco framework.
Try it out!
A1880
a "Form" inherits from class "AbstractForm".
In the source of AbstractForm you can find:
|
|
Source code |
1 2 3 |
Public Sub SetDefaultClose() Me.setDefaultCloseOperation( Me.EXIT_ON_CLOSE ) End Sub |
This method is called by default in "Module1" of a standard Jabaco project:
|
|
Source code |
1 2 3 4 5 6 7 8 |
Public Form1 As New Form1 Public Sub main(ByJava args() As String) Dim myArgs() As String myArgs = args Form1.SetDefaultClose() Form1.show() End Sub |
If you comment out (or leave out) the line "Form1.SetDefaultClose()" a user abort will cause an event you can intercept:
|
|
Source code |
1 2 3 |
Public Sub Form_Deactivate() msgbox "Deactivated!" End Sub |
Well, for me it would be nicer to have a more VB6 like situation. So my suggestion would be to add an unload event for Forms in the Jabaco framework.
Try it out!
A1880
Thanks again!
Wow, thanks for that quick answer. That is great; I had not noticed that there was a "module 1" and associated code. I think it is fine to leave it like that, it does not have to be exactly the same as VB6.
The only reason I wanted transparency was to use a form with no border, and make my own task bar in order to have my own button to close the form, and I would put Deactivate code there. This is simpler, I can use the Deactivate routine that appears when the default action in module 1 is commented out. Perfect!
I still am somewhat curious if it is possible to change the form background to transparent, even though there is no particular reason to do that now. As I say, I tried to find a number in Form1.class which might be the RGB( , , , ) code but was unable to find it.
Another comment: I note all the class files which might conceivably be used by any project are included in the JAR file of every project. The JAR files would be very small if only necessary class files were included. I wonder what is the reason for including them all? As Jabaco becomes more popular there will be program users with many many copies of each class file on their home computers....
JM
The only reason I wanted transparency was to use a form with no border, and make my own task bar in order to have my own button to close the form, and I would put Deactivate code there. This is simpler, I can use the Deactivate routine that appears when the default action in module 1 is commented out. Perfect!
I still am somewhat curious if it is possible to change the form background to transparent, even though there is no particular reason to do that now. As I say, I tried to find a number in Form1.class which might be the RGB( , , , ) code but was unable to find it.
Another comment: I note all the class files which might conceivably be used by any project are included in the JAR file of every project. The JAR files would be very small if only necessary class files were included. I wonder what is the reason for including them all? As Jabaco becomes more popular there will be program users with many many copies of each class file on their home computers....
JM
Hi JMOODY,
Yes I would agree with you, it should be possible to decide wheter the Jabaco-framework is linked outside or is compiled together in one file.
But I think Manuel did the right decision to compile it in one ... remember Jabaco is brand new and at the moment it is beta version. So in this way it can be much more simpler for Jabaco to gain more and more users - just give away one file to make your customers, friends or colleagues say "Wow".
No extra installation has to be done (beside Java of course)
greetings
OlimilO
Quoted
Another comment: I note all the class files which might conceivably be used by any project are included in the JAR file of every project. The JAR files would be very small if only necessary class files were included. I wonder what is the reason for including them all? As Jabaco becomes more popular there will be program users with many many copies of each class file on their home computers....
Yes I would agree with you, it should be possible to decide wheter the Jabaco-framework is linked outside or is compiled together in one file.
But I think Manuel did the right decision to compile it in one ... remember Jabaco is brand new and at the moment it is beta version. So in this way it can be much more simpler for Jabaco to gain more and more users - just give away one file to make your customers, friends or colleagues say "Wow".
No extra installation has to be done (beside Java of course)
greetings
OlimilO
Hi,
That makes a lot of sense, I guess, though I don't understand it completely.
I remember some years ago me and my son Jamie were trying to use Java and a message came up on the computer saying it is deprecated software. So we didn't go with Java. Then later visual basic is deprecated in favour of the .NET framework. That messed me up a bit, both Java and Basic getting deprecated, it is really great that they are both back again.
Here is my Deactivate routine
Public Sub Form_Deactivate()
If activated=1 Then
Call MYsub()
Else
activated=1
End If
End Sub
I had to set dim activated as integer in the general declarations and activated=0 in Form_Load This is because when doing things in the way you described above, Form_Deactivate would fire twice, once when the form is loaded and once when closed by the user. The integer "activated" forbids the call of MySub when the form is loading.
Don't forget to think about whether there is any way to set an alpha for the form background.
JM
That makes a lot of sense, I guess, though I don't understand it completely.
I remember some years ago me and my son Jamie were trying to use Java and a message came up on the computer saying it is deprecated software. So we didn't go with Java. Then later visual basic is deprecated in favour of the .NET framework. That messed me up a bit, both Java and Basic getting deprecated, it is really great that they are both back again.
Here is my Deactivate routine
Public Sub Form_Deactivate()
If activated=1 Then
Call MYsub()
Else
activated=1
End If
End Sub
I had to set dim activated as integer in the general declarations and activated=0 in Form_Load This is because when doing things in the way you described above, Form_Deactivate would fire twice, once when the form is loaded and once when closed by the user. The integer "activated" forbids the call of MySub when the form is loading.
Don't forget to think about whether there is any way to set an alpha for the form background.
JM
Similar threads
-
General topics, questions and discussions »-
ListBox operations
(Feb 28th 2009, 6:15pm)
-
Tips, Tricks, Samples & Tutorials »-
Audio Recording sample with NativeCall, Thread, Java-Calls, etc.
(Jan 10th 2009, 7:54pm)
-
General topics, questions and discussions »-
Repory
(Feb 19th 2009, 7:44am)
-
General topics, questions and discussions »-
File operations don't work for me
(Dec 14th 2008, 7:32pm)
