Flex - including a host component class that is in a sibling folder - flex4

I have a FLEX project, in the 'default' folder of which I have 2 sub-folders - "skins" and "scripts". My custom skins and actionscript classes (all defined in "scripts" package namespace) are stored in these sub-folders respectively.
Now, in one of the skins I refer to a AS class that is in the "scripts" folder, say, like this:
[HostComponent("MyCustomButtonClass")]
This obviously reports the error:
1046: Type was not found or was not a compile-time constant: MyCustomButtonClass.
How do I make the class reference in host-component work?
(If it helps, there is main.mxml in the default package where all these components are used)

Just add both folders to the source path and use package structures.

Related

Default class folder in Xamarin.Forms

What is the default class folder in Xamarin.Forms?
In web development solution there is App_Code folder, where should I use in Xamarin.Forms ?
You can organize your code however you like. You can place everything in the root folder, or create separate (even nested) folders. Xamarin Forms does not require any special folder structure.
I tend to use a structure like this, but this is solely my preference:
Root
- Model
- View
- ViewModel
- Service
- Data

How to make Visual Studio forget a namespace?

I have a project called Geometry inside of which I had created a folder, and had been referencing that folder by its namespace, "project".Geometry.
I decided that I would rather simply name a class Geometry instead of the entire folder, so I moved all of the classes inside of the folder up a level.
When I named my new class "Geometry" I still get:
namespace "" already contains definition for "Geometry"
How can I make Visual Studio forget about that namespace?
You have to do more than just move the classes up a level from that folder. You must go into each of them and change the namespace associated with it.
code like this probably still exists in those classes:
namespace projectnamespace.Geometry
{
...
}

Qooxdoo - how do i create a new theme and use it in the application?

I am quite new to qooxdoo and I need help in creating a custom theme for my application.
I copied the native Modern theme and modified some of its features, now my question is how do I add it as new theme to qooxdoo and how can I use it in my application?
any help or guidance would be greatly appreciated.
You don't need to copy it over, simply extending the theme would be good. If you created your app with the qooxdoo desktop skeleton using the create-application.py helper, you should already have a custom theme in place running and extending the modern theme. If not, you simply have to edit the config.json file which should be in your root project folder and search for a key named QXTHEME. The value of that key is a classname which specifies your theme. Change that to your custom theme class and rebuild the app to see the result.
Here are some further resources on how to work with themes: http://manual.qooxdoo.org/current/pages/desktop/ui_custom_themes.html
To add a bit to Martin's answer: You don't copy and modify theme code, you extend and override, much as with class code.
If you create an application skeleton with create-application.py, the default code structure under source/class already contains custom theme classes (under source/class//theme/*). The thing is those theme classes extend from the Modern theme without actually overriding anything, so you effectively get the Modern look and feel.
But you can then go ahead and flesh out those custom theme classes, with properties that suite your taste, thereby creating your own theme.
i found it very difficult to create a custom theme by extending one of the existing native themes (classic, modern... etc) without looking at the source code, also i don't want to mess up the original API's files by modifying them, so i did the following:
1- replaced files in my application's directory: myapplication/source/class/myapplication/theme/ with the files in /qooxdoo-directory/framework/source/class/qx/theme/modern/. replaced four files in total (Appearance.js, Decoration.js, Color.js and Font.js).
2- copied decoration directory from /qooxdoo-directory/framework/source/resource/qx/decoration/Modern to my application's directory: myapplication/source/recourse/myapplication/decoration.
3- copied icons directory from qooxdoo-directory/framework/source/resource/qx/icon/Tango to my application's directory myapplication/source/resource/myapplication/icon.
4- copied Tango.js from qooxdoo-directory/framework/source/class/qx/theme/icon/Tango.js to my application's directory myapplication/source/class/myapplication/theme/icon/Icon.js.
5- edited the meta file Themes.js and changed it to:
qx.Theme.define("myapplication.theme.Theme",
{
meta :
{
color : myapplication.theme.Color,
decoration : myapplication.theme.Decoration,
font : myapplication.theme.Font,
icon : myapplication.theme.icon.Icon,
appearance : myapplication.theme.Appearance
}
});
6- edited Icon.js file (which i copied from Tango.js in step 4) and changed it to:
qx.Theme.define("myapplication.theme.icon.Icon",
{
title : "myIcons",
aliases : {
"icon" : "myapplication/icon"
}
});
7- edited Decoration.js, Appearance.js, Color.js and Font.js in my application's theme directory and changed the classes' namespaces from:
qx.Theme.define("qx.theme.modern.<file's name>",
to
qx.Theme.define("myapplication.theme.<file's name>",
8- corrected assets paths in Decoration.js and Appearance.js from the original path qx/decoration/Modern or qx/icon/Tango to the one relevant to my appliaction myapplication/decoration and myapplication/icon, for example:
#asset(qx/decoration/Modern/toolbar/toolbar-part.gif)
changed to
#asset(myapplication/decoration/toolbar/toolbar-part.gif)
ps: the relative path in an application is application-name/source/resource, so you can refer to any directory in this folder by application-name/folder-name.
9- likewise in step 8 i changed aliases in decoration.js to:
aliases : {
decoration : "myapplication/decoration"
},
10 - ran generate.py file in myapplication/source.
and done, now i can change anything i want without crashing the API :)

iPhone SDK: Localization of external class files?

I am adding some external classes to my already-localized project that include their own localization strings. For some reason the localization isn't working in these classes. It should be noted that I am not copying the external class files to my project, just adding a reference to them. I thought the problem could be that the external string file couldn't have the same name as the projects string file -- Localizable.strings -- so I changed it to something unique for the class. This didn't help. I also tried dragging the classes string files directly to the "Copy Bundle Resources" of my project to make sure that the strings in the bundle. Still no luck.
Interestingly, if I add these localized classes to a different project that isn't yet localized -- e.g. there isn't any Localizable.strings file in the project -- the class localizations work fine.
Suggestions?
You should use NSLocalizedStringFromTable instead of NSLocalizedString to extract strings from tables other than the default Localizable.strings.

Xcode - change project templates

So I can add new templates for single files, but I want Xcode to uses these files when setting up the new project (most noticeably the Controller and Delegate .h and .m files). How do I do that?
In addition to the templates for individual classes that you found, there are also templates for the various project types. If you just want to replace a single class file that is already being added in the projects you can just replace the file in each of the project template files (as long as the names are the same). You will need to copy the template files into each project template that you want to change it in. The other option is to make your own project templates with whatever default files you want.

Resources