[flexcoders] Re: Formattin dates in DataGrid with itemRenderer
Thankyou very much... I managed to solve it. At the end, I used labelFunction, cleaner than all other ways I tried. Thanks a lot.
[flexcoders] Re: Formattin dates in DataGrid with itemRenderer
Thanks Manish, I've some examples using a custom class extending Label, but But I can't make them work. Another question... I have to use formatted data to make some operations, but I can't manage it. I use DataGridItemRenderer in some columns, assigning as: DataGrid.columns[1].itemRenderer = new ClassFactory(myRenderer1); ... I'm using a cursor to iterate across the dataProvider, like this: while(!cursor.afterLast){ for each (var i: DataGridColumn in this.listaDatos.columns){ buscando_texto = cursor.current[i.dataField].toString(); [make some ops] } cursor.moveNext(); } How can I get the formatted data? Thanks a lot. > > You can just use a custom labelFunction instead of a custom renderer. >
[flexcoders] Formattin dates in DataGrid with itemRenderer
Hello all... I need your advices once more time. I need to format some dates in a datagrid, data comes in MMDD format, and I have to show as DD/MM/ date. I've read some articles about this, but I do not manage to understand too much. I'm using a custom DataGridItemRenderer extension Class, overriding set text function and, at this moment, it works fine, but I'm quite sure that better ways exist. Has someone used some better method? Thankyou very much for your help. J Pablo
[flexcoders] Re: submenu can't show completely
Thankyou all... I have a solution: Sadly, Menu implementation "controls" menu-out-of-bounds, with the code posted upper: from mx.controls.Menu.show(... , ...) [CODE] // Adjust for menus that extend out of bounds if (this != getRootMenu()) { var shift:Number = x + width - screen.width; if (shift > 0) x = Math.max(x - shift, 0); } [/CODE] As you can see, This piece of code can only control the right edge of the screen... so it can result useless. Thanks to you, now, I use onShow event and callLater to play a custom animation. Here is my code: [CODE] //this function is called in the eventListener(onShow) private function processAfter(event: MenuEvent): void { //root menu is an exception in my schema. if (event.menu.parentMenu != null){ var current_menu: Menu = event.menu; var menu_height: int = current_menu.height; var menu_width: int = current_menu.width; /*system execute the show function before the menu can be in its correct place, I use these two lines to avoid menu can be visualized (perhaps, it is not necessary) */ current_menu.height = 0; current_menu.width = 0; this.callLater(this.moveSubmenu, [current_menu, menu_height, menu_width]); } } /***/ private function moveSubmenu(current_menu: Menu, menu_height: int, menu_width: int): void { var bottom_edge_menu: int = this.rootMenu.y+this.rootMenu.height; var submenu_edge: int = current_menu.y + menu_height; var pixels_upper: int = 0; if (limite_inferior_menu < limite_menu) { pixels_upper= (submenu_edge - bottom_edge_menu); } /*restoring menu height and width*/ current_menu.height = menu_height; current_menu.width = menu_width; var animate_menu: Sequence = new Sequence(); /* here comes animation sequence creation, using pixels_upper to move up current_menu.y position*/ animate_menu.play([current_menu]); } [/CODE] I will continue looking for new solutions for this problem. Thankyou very much for this help. J Pablo
[flexcoders] Re: submenu can't show completely
Thanks Roman, I will keep in mind your advice. Sadly, getBounds(Application.application) doesn't work. > > Never played around with getBounds/getRect methods and the mechanism is > still a little bit vague for me but I though maybe you should choose another > targetCoordinateSpace. > Maybe in your case it should be something like Application.application.
[flexcoders] Re: submenu can't show completely
Thanks a lot, Manish. > > If I'm not wrong, menu objects are directly parented by the system > manager. You can verify this by trace()'ing menu.parent. You want to > use that parent object with localToGlobal(). In createMenu, first parameter is assigned to menu.parent property, I used null, so, ok, my menu.parent is System Manager for all (menu and submenus). But I've problems with submenus, because menu.parent.localToGlobal(event.menu.x, event.menu.y) returns (0, 0) for every submenus. (system_manager === menu.parent) I'm listening the onShow event, is this correct? It seems that the system buid the menus in the position 0,0 and then it moves them to their places. I'm loading data from an external XML and I'm saving main menu in a class variable and move it manually to its place, and it is the only menu that doesn't return (0,0) in localToGlobal... I'm a bit confused... any other ideas? Thankou all very much for these minutes.
[flexcoders] Re: submenu can't show completely
thanks Manish, your idea sounds well, [CODE] var container_bounds: Rectangle = this.getBounds(this); var menu_bounds: Rectangle = event.menu.getBounds(this); if (!container_bounds.containsRect(menu_bounds)){ //MOVE UP SUBMENU } [/CODE] event.menu gives me the submenu, correct, but submenu's position does not seem to be relative to the container, but to the own submenu option. (getBounds op gives me a Rectangle in (0,0) upper-left and (100,100) bottom-right). localToGlobal did not seem to work either. How can complete this solution? How can take the correct container (or application) > > You can listen for the "menuShow" event on the root menu object. The > event object's menu property actually points to the submenu that's > being popped up, through which you can check its position and size and > make sure it's within the screen area (move it). > > On 4/23/07, kkinaru <[EMAIL PROTECTED]> wrote: > > Hello all. > > > > This time, I have a Button in the bottom of my flex application. This > > button shows a Menu (like the start button in windows). First menu is > > OK, but the last submenu is clipped, because it exceeds the bottom > > edge of my flex app. > > > > Does exist a way for controlling that stuff in my submenus? > > > > > > Thankyou very much in advance. > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > > > > > > >
[flexcoders] Re: submenu can't show completely
Thanks for your answer. I'm sorry for the little explanation before. Take this piece of code. [CODE] public function createMenu(): void { this.menu = Menu.createMenu(this.startButton, this.menuData, false); this.menu.labelField = "@label"; this.menu.styleName = "startMenuStyle"; this.menu.show(-1000,-1000); this.menu.hide(); var p_start: Point = this.botonInicio.localToGlobal(new Point(0,0)); var menuheight: Number = this.menu.height; this.menu.show(p_inicio.x, p_inicio.y - menuheight); } [/CODE] menu is a mx.controls.Menu object, loaded from an external XML file. startButton is a basic Button, with onClick="createMenu()" and no more. I use ' show (-1000, -1000); ' because the height of my menu is 0 until I show for first time (does exist another way???). Thankou very much. > > How do you show your menus? Using PopUpButton? > Whatever the mechanism there is a way to specify x, y for the menu. > > R.
[flexcoders] submenu can't show completely
Hello all. This time, I have a Button in the bottom of my flex application. This button shows a Menu (like the start button in windows). First menu is OK, but the last submenu is clipped, because it exceeds the bottom edge of my flex app. Does exist a way for controlling that stuff in my submenus? Thankyou very much in advance.
[flexcoders] Problems with data in a DataGrid control
Hello all. I'm making 2 buttons, both act with a Datagrid. The first button implements the search task, and the second one makes that all columns change their size to fit the longest text of each column. I've some questions about these themes. How can I select the first column that contains the searchd text? How can I get the size in pixels from a String? Or, perhaps, there is any other way to adjust column width. Can you give me any idea about this? Thanks a lot in advance.
[flexcoders] Re: A question about rsl files and path
First all, thanks, Brian, for your answer. I'm using Flex builder path > Add SWC, I'm triying with your options, but I can't see any difference as result. When I build my Library, I get a file library.swf, packed in my .swc. When I build my project with this library (included as Right click project > properties > Flex Build Path > Library Path > Add SWC ), I have some files in the root directory, AND library.swf, also in the root directory. I want to remove this file, or, at least, change it to a subdirectory, if it's possible. I'm quite sure that the solution is a simple use of paths and compiler options. > > When working with applications and flex libraries side by side just > include the library as a project. > > Right click project > properties > Flex Build Path > Library Path > Add > Project > > You then may need to change the build order of your projects to make > sure the Library gets built before the application >
[flexcoders] A question about rsl files and path
Hello all. I'm a new flex programmer, and I had not too many problems... since now. I have two proyects in flex builder 2 (Application and Library) and I need to use the library in my application. This library (in .swc format) must be deployed in a subfolder, but flex builder copies the unpacked .swf file in the app root folder. I try it with external-library-path, -runtime-shared-libraries, extern, and some another compiler options, but I don't manage to separate this .swf file. I've read some articles about .swc and external .swf use, but I can't find this information neither an example of compiler options needed in flex builder 2. Can anyone give me some advice about this problem? Thankyou very much in advance.