TBX C++ library going through the !Help
andrew k (267) 76 posts |
I have been going through the TBX !Help tutorial showing how to manually to setup a TBX app to learn the structure. I have got to the end of chapter 3 and the app compiles although I have add to replace ‘gcc’ in the supplied build command with ‘g++’ but I hear GCC have moved to using g++ for C++. But the icon is not showing on the icon bar when the app is launched and I have double checked and checked that I have got the names of the sprite correct in the res file. Are there any common mistakes with icons not showing? I have used width 34, height 17 but do the other sprite dpi or colour settings have to be exact too? The app !TbxMin shows in the task list so looks like it is launching correctly. |
Julie Stamp (8365) 474 posts |
Have you got the Iconbar object set for auto-create and auto-show in the object flags in ResEd? |
andrew k (267) 76 posts |
Thank you Julie. I hadn’t noticed the menu when clicking on the ResEd items I was looking for them in the window that opens when you double click on a ResEd item. All working now. |
andrew k (267) 76 posts |
I’m back with another question. I am trying to use the Makefile from section 3 of the TBX !Help but I am getting the error below. The make file content I have just copied from the guide but I’m also new to C++ so make files are also a learning curve for me too. MakeFile
Error
edit the code does compile manually running g++ so I think the issue is with something in the makefile and not in the source code itself. |
Rick Murray (539) 13851 posts |
It appears to be failing at the point of trying to elf2aif… so… what did g++ actually output if not !RunImage,e1f? Check your typing as well. The makefile snippet you posted refers to |
andrew k (267) 76 posts |
It was my typing causing the problem. So most of the elf’s should be (ee one eff) but elf2aif is (ee ell eff) but I did not spot that when typing the make file from the guide. Thanks Rick |
andrew k (267) 76 posts |
Me again! I do appreciate the help people are giving me on this learning C++ on RISC OS journey. Hopefully I will be able to contribute some small apps back to the community on the back of peoples help. So onto my latest question, I am looking into hooking up button events to code and I have got this to work in the way described in the TBX !Help. The !Help shows you how to do it like this:
Where ‘_calculatedCommand’ is an instance of class that has a method ‘execute’ that runs when the event is caught. But what I wanted to know is can I pass a method name to the event listerner instead? If so can I use both a method in the ‘_calculatedCommand.myMethod()’ or a method in the current class.
|
Alan Buckley (167) 233 posts |
Your can’t do this directly I’m afraid. There is a CommandMethod template that allows you to define a command that executes a method on a class and then you can add that with window.add_command.
and in the constructor.
Hope that helps. |
andrew k (267) 76 posts |
Thanks Alan, I will have a play with what you suggest above. If the pattern for using TBX is to have a command class for each event then that’s fine I just wondered if I could have one class that held all the events for a small application that might only have less than 10 events. |