Closed SamSandq closed 4 months ago
Hi! yes there is a bug in window_OnMoved()
. I have fixed it in this commit https://github.com/frang75/nappgui_src/commit/98734206bdea477f138d23281b05559790fba92f. Thanks for the report.
Therefore, I suspect your crash is for other reason (division by zero). If the problem persists, try to identify in your app part. If finally, is in NAppGUI part, please provide a minimum code to reproduce it.
Regards!
I tried with exactly the same code in 1.4 as in 1.3, and it still fails on 1.4. The 'naphello' compiles and runs OK.
However, it seems only to crash on mouse moves, once a control (table) is selected. If I remove the tables, it does not crash, but there are other issues; I cannot resize the window, nor can I move the focus in my photo collection grid with the cursor keys. All of these work in 1.3.
Another thing: in 1.3 the app I build is shown in the context switcher (cmd-tab); in 1.4 these are not shown. Is it perhaps not building true desktop apps?
The screenshot on failure is as follows.
If you think it would help, I’ll send you the source code?
Further to the above...
I replaced the HelloWorld's main.c with my source file, and it compiles and runs better (e.g., now there is a context switcher icon). However, it still crashes, now on
data->mouse_row = (mouse_y - head_height) / data->row_height;
line 956 in i_onMove(TableView view, Event e) called from i_onMoved (line 105, listener_pass_event). So... seems like there is a problem with moves/resizing as well as building, as the process setting up a new application for Mac in https://nappgui.com/en/guide/newprj.html and https://nappgui.com/en/guide/win_mac_linux.html#h4 do not produce the same result as when building as if it were one of the demo apps.
Here is the screen shot.
Any ideas?
Umm its strange. Its a division by zero crash. Please share the code to debug it. Thanks!
Here...
Change the test image file in get_image() to something you have.
Sam
Den lör 30 dec. 2023 kl 09:59 skrev Francisco García Collado < @.***>:
Umm its strange. Its a division by zero crash. Please share the code to debug it. Thanks!
— Reply to this email directly, view it on GitHub https://github.com/frang75/nappgui_src/issues/80#issuecomment-1872478110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMAVI5QKJM25YGZDWD2GCW3YL7CW7AVCNFSM6AAAAABBGR2UEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGQ3TQMJRGA . You are receiving this because you authored the thread.Message ID: @.***>
Sent via email, but cannot see the code.... here it is again (cannot upload .c files, change extension from .txt to .c)
I found the problem. Its a division by zero for TableView controls without columns. Its fixed in this commit https://github.com/frang75/nappgui_src/commit/be0790cdeeb926dcb26ef858a782005154934ae1
//tableview_new_column_text(tree);
//tableview_new_column_text(tree);
//tableview_new_column_text(tags);
//tableview_column_width(tree, 0, 100);
//tableview_column_width(tags, 0, 100);
//tableview_header_resizable(tree, TRUE);
//tableview_header_clickable(tree, TRUE);
If you just want a list of images, you can also use a ListBox, very lightweight control https://nappgui.com/en/howto/urlimg.html
Thank you very much for your reports. They help to improve to code.
Well, now it doesn't crash!
However, there is another difference between 1.3 and 1.4: the view is clipping correctly (top/bottom) on 1.3, but not on 1.4. When I scroll, the photos are happily shown all the way up to the top window bar, and bottom window border.
Also, when following the build a new app instructions, it still seems like it's not building a proper window app; no icon in the context switcher, and I cannot resize the window at all.
Ideas?
(when substituting for one of the demo apps, it is showing the icon + allow resize)
For application icon, your project needs a /res
folder on the top dir (e.g. /fintus/res
) with three files: logo.icns
, logo48.ico
and logo256.ico
. This folder is automatically created by nap_project_desktop_app(napphello hello)
the first time CMake runs (without /fintus
folder created)
https://nappgui.com/en/guide/newprj.html#h2
NAppGUI build system will take the icon and link it with the app in each platform. You can use the icons in examples or design your own.
https://nappgui.com/en/guide/resources.html#h10
After create the /res
folder, run again cmake.
Also, please review your project source tree looks more or less like that:
CMakeLists.txt
fintus (folder)
|-CMakeLists.txt
|-fintus.c
|-res
|-logo.icns
|-logo48.ico
|-logo256.ico
The main CMakeLists.txt
should look more or less:
cmake_minimum_required(VERSION 3.0)
project(MySolution)
find_package(nappgui REQUIRED)
include("${NAPPGUI_ROOT_PATH}/prj/NAppProject.cmake")
nap_project_desktop_app(Fintus fintus)
And the /fintus/CMakeLists.txt
:
nap_desktop_app(Fintus "" NRC_EMBEDDED)
target_link_libraries(Fintus ${NAPPGUI_LIBRARIES})
You can download and test this demo package:
https://www.nappgui.com/examples/nappdice.zip
Now we are getting somewhere!
The app builds fine now... except that it's not picking up the icon. I've tried with NR_NONE or NRC_EMBEDDED which both should do it, but my app doesn't get it.
The NAppDice app does, however.
I'm now trying to get rid of the scrolling problem.... it looks like this:
Maybe the order of the controls matter? It working in 1.3 ...
It seems there is something wrong with your installation. I have clone, build, install nappgui. Later create a new project from scratch. Follow these instructions:
Important I think the initial dimensions of view control are soo big. If the window is resizable the view control will expand.
git clone --depth 1 https://github.com/frang75/nappgui_src.git
cd nappgui_src
cmake -G Xcode -S . -B build -DNAPPGUI_DEMO=NO
cmake --build build --config Release -j 4
cmake --install build --config Release --prefix /Users/fran/nappgui
cmake_minimum_required(VERSION 3.0)
project(Fintus)
find_package(nappgui REQUIRED)
include("${NAPPGUI_ROOT_PATH}/prj/NAppProject.cmake")
nap_project_desktop_app(Fintus fintus)
Run CMake. This will create a new fintus folder with a demo project. Build it and run. Its a HelloWorld demo. The App icon works fine. Make sure that find_package() uses the new installation (remove previous installations)
cmake -G Xcode -S . -B build -DCMAKE_INSTALL_PREFIX=/Users/fran/nappgui
cmake --build build --config Debug
Just change the code in fintus.c
by your code and recompile.
Important
find_package() can find older installations. Review the NAppGUI message
cmake -G Xcode -S . -B build -DCMAKE_INSTALL_PREFIX=/Users/fran/nappgui
Found NAppGUI at '/Users/fran/nappgui'
Version: 1.4.0.4772
Linker: static
Hi again, and thanks for your patience!
I did exactly like you said above, and all completed perfectly without error messages.
The last was:
(base) √ funtus4 % cmake -G Xcode -S . -B build -DCMAKE_INSTALL_PREFIX=/Users/sam/nappgui Found NAppGUI at '/Users/sam/nappgui' Version: 1.4.0.4772 Linker: static -- - [OK] Funtus: Desktop application -- Configuring done -- Generating done -- Build files have been written to: /Volumes/SAMSUNG/funtus4/build
So everything seemed fine... and the HelloWorld app builds OK, and runs OK. BUT the icon is still missing! I checked with Xcode, and it shows:
So it definitely recognises the logo.icns file...
I will now check with the real Funtus code, instead of the helloworld.
Cheers, Sam
I think I found out why it doesn't pick the icon... the project files were on a removable drive, and some Apple security measure (maybe nrc or some other executable doesn't have the rights to access the other drive?) prevents it from picking up the icons.
I tested it with you fintus_prj.zip and left it on the main drive (Macintosh HD) ---- and now the icon shows as it should.
This leaves only one problem left: the scrolling. Your fintus also scrolls incorrectly on my Mac, so something is still different between your system (you screenshot seemed perfect) and mine.
What could that be? And how could I track it down?
Cheers, Sam
I really i don't known what is happen. Looking your code i see you create a lot of panels. It's not necessary. For your design, only one Panel (the main) is neccesary with a (1,3) layout. In the middle cell (0,1) you put a (3,1) sublayout with the view and two tables.
Main Layout (0,0) Label (filters and stuff) (0,1) Sublayout (3,1) (Tree, View, Tree). layout_hexpand(1,0) (only view will resize) (0,2) Information
Please review the Layout Chapter https://nappgui.com/en/gui/layout.html https://nappgui.com/en/howto/guihello.html#h13
When your GUI grow, you can change the (0,0) cell with a Sublayout. The same for the (0,2) information label.
Use subpanels only is necessary if you want to switch different layouts at runtime https://nappgui.com/en/howto/guihello.html#h15
I known its not easy at the beginning. Good luck
You are probably right. I will try to simplify the design tomorrow.Cheers,Sam30 dec. 2023 kl. 21:17 skrev Francisco García Collado @.***>: I really i don't known what is happen. Looking your code i see you create a lot of panels. It's not necessary. For your design, only one Panel (the main) is neccesary with a (1,3) layout. In the middle cell (0,1) you put a (3,1) sublayout with the view and two tables. Main Layout (0,0) Label (filters and stuff) (0,1) Sublayout (3,1) (Tree, View, Tree). layout_hexpand(1,0) (only view will resize) (0,2) Information Please review the Layout Chapter https://nappgui.com/en/gui/layout.html https://nappgui.com/en/howto/guihello.html#h13 When your GUI grow, you can change the (0,0) cell with a Sublayout. The same for the (0,2) information label. Use subpanels only is necessary if you want to switch different layouts at runtime https://nappgui.com/en/howto/guihello.html#h15 I known its not easy at the beginning. Good luck
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
Sorry to bother you again...
1) Your suggestion to simplify was excellent, the app became much clearer. Thank you! 2) the scrolling problem is real; I build the DrawBig demo app and scrolling in that shows this:
As you can see the view does not obey its layout boundaries; it is scrolling above to the window bar, and is wider than it should be. It is working correctly in 1.3.
Any ideas? Anything I can test/modify?
Ummm. It's a curious case. The view is correctly dimensioned (the scrollbars are ok). But the view is drawing outside its boundaries. Something happens with the clipping.
Are you using macOS Sonoma? Please tell me about your macOS/Xcode/processor. I'll try to reproduce the same environment. I have tested NAppGUI 1.4 in Ventura and Lion.
I am on a Macbook Pro, Sonoma 14.2.1:
and using latest Xcode 15.1
Please note that the view is working on NAppGUI 1.3
Fixed in this commit https://github.com/frang75/nappgui_src/commit/ac038f90e555f8751e4dab1889e0448b47c900ae
Apple has changed the default NSView clipping in Sonoma: https://indiestack.com/2023/06/view-clipping-sonoma/
The code works in NAppGUI 1.3 because this version uses NSScrollView
, but 1.4 uses NSView
with scrollbars. NSScrollView
dificults the drawing of static overlays.
Thanks for reports and patience!
Tested and works!
Por fin, you may close this issue!
My project running well (OK, compiles. runs, but not yet working as it should) in 1.3, but fails in 1.4 with message:
Demo apps run well.
What could be wrong? The CMakeList file is:
I am on the mac using XCode. Tried using makefiles as well with same result.
ADDED:
I noticed that the crash may originate in a function i_OnMove, so I added
with a simple myMove:
NOW, the crash is immediately on launching, in i_create creating the window, on the line window_OnMoved(...));, with the same error message.
ADDED 2:
I added the same window_onMoved and myMove to the demo app drawbig.c, and now the app crashes on start with a NULL pointer access, window, file: oswindow.m at line 526.
Is something seriously wrong with my installation of 1.4?