Yesterday i updated to the latest version of CodenameOne.
I like the new version of the new GUI but... 2 problems:
When I try to add a command from the new GUI, the code created to the java file creates an error. If I remember correct it says ";" missing. So i create now the command by code.
On buttons I create a new Action Event. It is created to the jave file, but it never run the code to the onButton_1ActionEvent handler. I tried with debug and never goes in there. It works perfect when i create the Action event from the code myself.
So is it a bug, or i do something wrong? Plugin Version is 3.5.5
Thank you
We released 3.5.6 yesterday which is still undergoing verification right now. When submitting issues/problems we need the version of the GUI builder from the about menu, it looks like this:
Related
Just got into monogame today. Noticed that my software wasn't taking any keyboard inputs when I tried to bind a key to a fullscreen toggle. Weirdly enough, it takes inputs from my controller just fine, but just not the keyboard. Keyboard.GetState().GetPressedKeyCount() also always returns 0, so I've got no idea what's causing the problem.
I'm not usually one to attach full code files, but the program loop class is only 72 lines, so it's here if it helps: https://pastebin.com/xcWnDvqL
Platform: Windows 10 Build 19044
Monogame Version: 3.8.0.1641 (DesktopGL)
I tried to set up my project the same way as you did, but I am unable to reproduce the issue. It probably has something to do with your system. You can try the following and see if it works for you.
Now this may sound silly, but when you provide input, are you sure the window is active?
Your game can detect input from the gamepad even when the window is inactive, but the same is not true for keyboard input. I noticed this while testing your program. So ensure that the window is active (by clicking on your game window) before pressing a key and see if the game is still unable to detect input.
I hope that this is the problem in your case. If not try the other fixes as shown below.
Update the Monogame packages.
The latest version of monogame available is v3.8.1, so you can update your templates.
Proceed to install the latest nuget templates (as it was mentioned by Monogame that many bugs have been hotfixes in this version. You can do so by doing the following in a terminal.
dotnet new install MonoGame.Templates.CSharp::3.8.1.303
Then proceed to make a fresh desktopgl or mgwindowsdx project and see if the issue persists.
Check for driver issues.
Monogame uses xinput/DirectInput(a package in DirectX) to detect input from the input devices. Maybe the issue has something to do with it. You can search and run dxdiag from the start in windows. Ensure your drivers (including video drivers) are up to date.
I know how to debug and modify CodenameOne source in an app. That is described here
Can I do the same for the code under iOSPort? I am interested in testing a modified version of Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m. using a build hint to append code to the delegate is not an option since what I need to test is a change within an existing method.
I think a recent update broke something in it but the ticket I raised on GitHub isn't being replied to, so I'd like to see if I can propose a fix myself
When you use include source the full iOS port is included into the source and you can debug directly into the port. You can just copy and paste your changes into there and then debug these changes. Then copy and paste it back.
That's how we test changes to the port.
I have a problem with my WPF application (a simple clicker game). I've just made a deployment/created a setup project using Microsoft Visual Studio Installer Projects extension for Visual Studio. Everything seemed to work fine, setup works good (tested on other computer) and furthermore the installed application almost works correctly. The only exception is a button calling function which is creating a new txt (something like a draft of a "save" file) file in a folder where the application is installed. Clicking this button cause instant crash of the whole application. Nothing else happens, no error message, the app just turns off.
I assume that the problem lies in access rights to the folder/administrator rights.
I've added txt file with the same name in the application folder using "File System" window in setup project, deployed and installed again. Even when the file exists the problem happend again (probably because of access rights when trying to override file content).
It's may be important that everything worked while running app through VS, also using .exe works fine on any computer. The problem is only with application installed using setup.
I'm not sure where the problem is so it's hard to show some code, to be honest i'm not even sure if it's a problem with code, maybe it can be solved with setting some setup project properties?
I would like to store some data locally between two sessions, i've choosed txt file because it's light and simple even if it's not the most elegant way.
I expect that installed application will be able to create and override txt file in it's folder.
P.S. if you need any code, screenshots or information about my setup please let me know in comments section, I will provide what's necessary
At the moment you install your program you're having administrator-rights. So the folder where your application is, also was created with administrator-rigths.
If you want to store data to this folder, you'll have to run your application as administrator. (not the best idea)
Otherwise you can change your code to write your file at runtime to a different location where you don't need administrator-rights.
For example:
string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
will give you: "C:\Users\MyUserName\AppData\Local"
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
will give you: "C:\Users\MyUserName\AppData\Roaming"
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
will give you: "C:\Users\MyUserName\Documents"
And some error-handling around the saving of the file would be very nice and helpful ;)
Thank you everyone for solution and knowledge, the problem was as I assumed (access to the path denied).
I was using this code to create a path:
Directory.GetCurrentDirectory() + "\\SyntyhCitySave.txt";
Creating a file in a special directory instead of application folder works, that's the solution for my problem:
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\SyntyhCitySave.txt";
Tomtom answer marked as accepted.
In this project I started to create a form with the GUI Builder but I did not feel comfortable with this tool. Consequently I rather hand coded it based on a demo example https://github.com/codenameone/MaterialScreensUIKit/blob/master/src/com/codename1/uikit/materialscreens/LoginForm.java.
I should mention that I changed the name for the hand coded form from MainForm to MainForm2 and that I am using Netbeans with the latest availabel plugin of CN1 (updated November 7th 2016). Now for nearly each and every simulator run (when I click on the IDE play button) I get this error :
ant -f /home/blablah/CN1Project -Dnb.internal.action.name=run run
Processing GUI builder file: /home/blablah/CN1Project/src/myPackage/MainForm.java
/home/blablah/CN1Project/build.xml:469: Gui builder source file corrupt, the don't edit below/above this line comments seem to be missing or modified!
ErrCcode A: -1 ErrCode B: -1
BUILD FAILED (total time: 0 seconds)
Line 469 reads : <generateGuiSources srcDir="src" encoding="UTF-8" guiDir="res/guibuilder" />
I understand the error message and I can confirm that the line comments is missing since I did create the form manually. Yet if I click a second time on the play button the simulator runs without error. Please note that the same behaviour also appears if I send build to CN1 server (two clicks needed).
What's the proper way of creating manually a Form (as shown in the demo codes), should I create it via new CN1/ GUI Builder Form or can I simply add the comments to make the compiling process happier ?
Any help appreciated,
In your project directory look under res/guibuilder and in that hierarchy you will find a .gui file matching your java source file. Delete that and the file will stop being a GUI builder file.
I've got a strange problem I haven't seen before. I can open an OpenFileDialog in Windows 7 without any problems. However, when I try my app on Windows XP, calling OpenFileDialog.ShowDialog() immediately crashes the application. It just vanishes! When running from the debugger, I don't get any unhandled exceptions. If I wrap the code in a try/catch block, nothing gets caught. I have also checked all thrown exceptions in Debug -> Exceptions, but nothing pops up. I'll try some of the other suggestions in the answers below and will report back.
Does anyone know how to resolve this problem? I found a post about something similar, but it was the opposite problem. I'll try tweaking the desktop settings to see if it's related to that, but I am dubious.
EDIT -- as a sanity check, I wrote a test WPF application that displays an OpenFileDialog directly via the main window as well as another Window that can be displayed by the main window. It totally works fine under Windows XP. So now I'm really confused. I have verified that I'm not doing something stupid like trying to display the dialog from a worker thread. The OpenFileDialog displays briefly, then disappears along with the application.
EDIT -- I'm going to try to reproduce this problem on another XP computer. For now, I'll try Windows XP mode and we'll see what happens.
I got a similar error when a DLL crashes when I open a OpenFileDialog. It turned out that OpenFileDialog changed the working directory so my dll tried to write to a relative file that did not exist.
Do you see any "First Chance" exceptions in the Output? Any entries in the event log? Does the default path you're using exist on the XP machine?
Try adding a handler to the App Domain's UnhandledException
Does the same happen when you use a brand new, stock FileOpenDialog without any tweaks? What about from a brand new app which does nothing but show a file open dialog?
See Galet's post
I cannot tell you what exactly the problem is, but here's what you could do to get a clue what's really happening. I assume you're using VS2008 or 2005.
1.Switch to release mode
2.Go to Debug\Exceptions, and mark all "Thrown" exceptions, like illustrated here: http://vvcap.net/db/JbWS_tzy2IpBoI7R7amm.htp
3.Run executable in debugger, ignore the warnings from VS that there's no debug info
It does seem that there's a win32 exception thrown some time during execution, but this way or another, you will get one or more messages from debugger explaining what kind of exception happened and where. In most cases those messages make it pretty clear what exactly went wrong
EDIT: One thing I forgot to mention is that unmanaged debugging must also be turned on, such like here (when you start program directly from IDE) or here (when you attach to running process)
link|edit|flag edited Apr 12 '09 at 22:32
answered Apr 10 '09 at 19:01
galets
1,2201924