Pop gives error when trying to Center in application - flex4

Hello I am having this error when trying to center my popUp. If I remove the centerPopUp code line, the popUp appears but of course is not centered.
The Error is as such:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.managers::PopUpManagerImpl/centerPopUp()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:494]
My Code:
var helpWindow:TitleWindow=
PopUpManager.createPopUp(this, screen_Name, true) as TitleWindow;
PopUpManager.centerPopUp(helpWindow);
Can someone address this issue?

You should be passing the FlexGlobals.topLevelApplication as an argument to createpopup if you want to center your panel/titleWindow later on.
So, here it will be
var helpWindow:TitleWindow=
PopUpManager.createPopUp(this,FlexGlobals.topLevelApplication , true) as TitleWindow;
PopUpManager.centerPopUp(helpWindow);
Im sure this will work.

Related

"fail to excute createRadialGradient,the provided double value is non-finite" on my canvas animation

I was intending to make a color gradient circle animation with canvas but I got this error "fail to execute createRadialGradient, the provided double value is non-finite" in the console. I am coding this with my MAC but when I copied those code to my windows PC it is just run perfectly. which is really confused me. the following error code would be like:
//...within my circle constructor
this.color = function(){
var grad = ctx.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r);
var colorArray = ['green','red','yellow','blue','purple'];
grad.addColorStop(0,colorArray[Math.floor(Math.random()*colorArray.length)]);
grad.addColorStop(.2,colorArray[Math.floor(Math.random()*colorArray.length)]);
return grad
I just don't think there is any error with my color()function but when I called this with animation in later phase the error just popped out. Is there anyone could help me with this? All the source code could be viewed at https://github.com/mystreie1126/CanvasExperiment/blob/master/Color%20gradient%20Circle%20Animation/colorCircle.html
thanks in advance

How to use PageSetup in vbs?

I tried to implement PageSetup class
With objWb.Worksheets("test")
.PageSetup.RightMargin=0.5 'executes okay
.PageSetup.PaperSize = xlPaperLegal 'throws an error
.PageSetup.Orientation = xlLandscape 'throws an error
End With
ERROR: Unable to set the PaperSize property of the PageSetup class
although .PageSetup.RightMargin=0.5 executed fine. Why don't the next two lines execute?
How to se paperLegal and landscape ?
Those are Excel constants. You'll need to define them yourself. Use the Object Browser within Excel's VBA screen (hit ALT+F11 to get to VBA, then hit F2 to bring up the Object Browser).
Const xlPaperLegal = 5
Const xlLandscape = 2

Creating a list of images in Qt and Ruby: ArgumentError

I am following examples all over, including this SO answer: https://stackoverflow.com/a/14114878/274354
My code falls over when trying to create the ListWidgetItem with the icon with this message:
/usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2642:in `initialize': unresolved constructor call Qt::ListWidgetItem (ArgumentError)
Here is the code:
require 'Qt4'
app = Qt::Application.new(ARGV)
# Main Window
widget = Qt::Widget.new()
# Create icon from a file, and create a list widget item from the icon
icon = Qt::Icon.new("/home/user1/Pictures/testimage.JPG")
item = Qt::ListWidgetItem.new(icon) #<-- Falls over here
# Create a list widget
list = Qt::ListWidget.new(widget)
# Set the icon size for the list
iconsize = Qt::Size(40,40)
list.setIconSize(iconsize)
# Add the list item with the image
list.addItem(item)
widget.show()
app.exec()
The error message is pretty clear. You're using QListWidgetItem constructor with invalid arguments. There is no QListWidgetItem constructor that accepts icon only. You need to pass item text as the second argument. See QListWidgetItem documentation.

Unable to remove element loaded by AJAX

I am trying to remove an element on AJAX success which was loaded and attached to the document during a previous AJAX call.
My code looks something like this:
$("#jobs-table-body").on("click", ".one-rc-button", function() {
var ctx = $.parseJSON($(this).siblings(".context").html());
$("#one-rc-candidate-id").val(ctx.candidateId);
$("#one-rc-job-id").val(ctx.jobId);
var loader = $("#wrapper").loader();
$.post($("#one-rc-form").attr("action"), $("#one-rc-form").serialize(), function(result) {
loader.remove();
if(result.success) {
// This works and returns 1
alert($("#candidate-row-" + result.rejectedCandidateId).length);
// This doesn't seem to be doing anything
$("#candidate-row-" + result.rejectedCandidateId).remove();
} else {
//$("#one-jc-messages").html(result.error);
}
});
});
The elements .one-rc-button and #candidate-row-<candidateId> were loaded by a previous AJAX call and they are attached to the document as I can very well see them on my page.
Now, on click of the previously generated .one-rc-button, I trigger a second AJAX call (which works fine) and on result.success, I want to delete the #candidate-row-<candidateId> (which is within the previously generated parent element).
The alert works and returns 1. So I know for sure that the selector is fine and it is matching one unique element.
What I don't understand is why it is unable to remove the element from the page.
Observations
I use Firefox 10.0.2 where this problem is reproducible.
On IE 8, it works (element gets removed)
On debugging the script on Firebug, I can verify that I have got a handle to the right eleemnt.
Try using FireBug to set a breakpoint on that line so you can see exactly what it's getting from that selector. Ideally break up the statement first, like this:
var unwantedDiv = $("#candidate-row-" + result.rejectedCandidateId);
unwantedDiv.remove(); // <-- Set a breakpoint on this line
You can then look at the unwantedDiv variable in the watch pane on the right of the firebug debugger and see what it is, what methods it has/has not got etc. I would assume that you are not getting back exactly what you think you are, possibly because of how you attached the div after the previous AJAX call. More information about JavaScript debugging with FireBug here.
Another option is to turn on strict warnings in the firebug console and see if you get any 'undefined method' errors, which don't stop the show on FireFox, but just bounce you out of that function. Do you get an error in IE?
Solved it by a really ugly workaround. I am still not sure what causes this behaviour.
if(result.success) {
var removeThis = $("#candidate-row-" + result.rejectedCandidateId);
removeThis.remove();
removeThis = $("#candidate-row-" + result.rejectedCandidateId);
if(removeThis.length != 0) {
removeThis.remove();
}
}
Now it works on both Firefox and IE.

how to get xtragrid focused cell's entity property

I want to get xtragrid focused cell entity property. Because of this :
I'm trying to get, focused cell isnull property, for this i need to get focused cell entityproperty
I tried to get object like (EdmScalarPropertyAttribute)gird.focusedrowvalue, but i got null value exception
How can i do this ?
Thanks
Another way to get the RowHandle of the XtraGridView is this:
int rowHandle = gridView1.GetSelectedRows()[0]
hope it helps, and if you are trying to get the value of the cell you can use the following code
object obj = gridView1.GetRowCellValue(gridView1.GetSelectedRows()[0], gridView1.FocusedColumn.FieldName);

Resources