i want to manually trigger *select object on the canvas event * - the same event that fires when a mouse click was made within an object area, and the object become selected - the controls become visible.
so in other words, i want to show controls for a specified object on the canvas MANUALLY, without user/mouse interaction. any help ?
solution was found in the docs.
if someone looking for the answer -
fabric.Canvas.setActiveObject(fabric.Object) ...
how the solution was found:
i understood that the wrong thinking was to look after the event that precedes the 'object:selected', but there is no such event !!! so i realized that all what i had to do is just look in the code for 'object:selected' and that's how i found which method fires it ... also it is well documented here, in docs .
suggestion: would be great to note about it in the articles - next to getActiveObject / Group . currently it appears only here - http://fabricjs.com/customization/
anyway, cangax and others participators - like very much your work !
thanks
Related
I have a Xpage that takes too long to load. So the client ask me to do a loading indicator.
I searched and found XSP.startAjaxLoading(), that I put in onClientLoad event of the Custom Control.
But now I don't know where should I put XSP.endAjaxLoading() to make the loading screen go away.
I'tried to use in afterRenderResponse and beforeRenderResponse: view.postScript("XSP.endAjaxLoading()"), since this comand is CSJS, but it doesn't work.
Thanks in advance.
I think you want to put it in the onComplete event. That can be difficult to find. You typically need to use the outline control to find it.
I have a video demo on NotesIn9 that has an example on this.
http://www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/?unique=http%3A//www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/
Your attempt (view.postscript) works only with full/partial updates and does not work for page loading.
You have used onClientLoad - which is executed when your page is finished with loading. I guess you get ajax animation after a while and it won't stop.
You should make preload screen - very simple XPage which starts animation and does not care to turn it off. In onClientLoad event redirect to your slow XPage. That will discard the animation.
I'd highly recommend using the Standby Dialog XSnippet https://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control. I use it as a standard in all XPages applications.
I used this answer as solution: https://stackoverflow.com/a/35481981/5339322
I've saw it a few days ago, what made me think twice is that using this i should know what is doing my XPages to delay. I ran some tests and discovered what, and it was a call to a method in the afterRestoreView event, then I migrated it to onClientLoad event and used the solution in the answer above cited.
But I'm afraid that I have to keep an eye on it, so if someone adds some code that delays in one of the another events of XPages I have to move it again, of course, if it's possible, if it's not, I'll figure it out something diferent.
Thanks for all the answers ans comments.
The whole day I am trying to solve this simple issue, but without any success.
I found a lot of hints in internet, but seems, that none of them is valid for my problem.
My issue is quite simple: I want to change the caption of a menue item while runtime
But it seems, that all solutions I found are very specific.
My requirements are this:
- it is a MFC application (VS2010)
- It is a SDI application, not MDI
- I want to change the caption of a main menu item (like "File"), not an entry of a submenue.
Because of main entry item, there is no ID for the menu item. Therefore solutions with ON_UPDATE_COMMAND_UI will not work!
My problems are:
- either the code I tried, is generating an assertion or exception
- or the function call returns with false
- or the function seems to work well, but I do not see any result (the caption is still unchanged)
Maybe I am using the wrong functions, or the wrong place for calling the functions.
Has anybody an example, which would work within my application pre-conditions?
Many, many thanks!
Richard
Windows cleverly hides the function to modify a menu under the arcane name of ModifyMenu. I hate it when they do things like that. Really makes me wish for Linux/Unix, with nice clear names like shmdt and mvwaddchnstr. Anyway, getting off my soap box for the moment, you'd call it something like this:
GetParentFrame()->GetMenu()->ModifyMenuW(1, MF_BYPOSITION, 0, L"New Item");
GetParentFrame()->Invalidate();
my question is, fabric.js makes active object on top of others when dragging.
I know a property can do this, can't remind.
Thanks.
You can do it like this:
canvas.add(red, blue); // add youre objects..
function myDrag(e) { // funciton on drag (moving)
e.target.bringToFront();
}
canvas.on({
'object:moving': myDrag,
});
Want to add more events? Use the Event inspector # fabricjs
I made a working Fiddle. Hopes it helps...
I know it's been a long time since you asked this but I want to answer it if anyone would stuck for that.
This behavior is default in fabric js right know but if you want to change it just set preserveObjectStacking to false when initializing the canvas. See more in documentation.
I have created a wxGrid with custom table. Whenever the user scrolls down to very bottom of the grid, I have to load the next 100 rows from my table. I tried EVT_SCROLL_BOTTOM() but I am not able to detect it. What is the right thing to do? Thanks.
I don't know the answer to your question but I am reminded that the grid was designed to work with an object of type wxGridTableBase that can be extended by the application. By extending this class, you should be able to do whatever caching you want inside of the extended object.
You could bind the scroll win event for the grid. I have encountered almost the same requirement as you. :)
self.Bind(wx.EVT_SCROLLWIN, self.OnScroll)
I have a core data document based cocoa app that is working well except for one slightly odd problem.
For some reason, if I make a change to any of my fields the menu/window don't seem to recognize it - ie. the red close button doesn't get the black 'dirty' indicator and the File/Save menu item isn't enabled. However, if I attempt to close the application (via command-Q), I do get the popup asking me if I want to save my changes.
It seems that the document's dirty flag is being set, but the window/menu items aren't reacting to it. I am curious as to where I might look to see why this might be the case. I suspect that it may have something to do with my window not knowing about my ManagedObjectContext...
The only slightly atypical behaviour is that my document's makeWindowControllers method has been overridden and I am adding my window controllers using a call to my document's [self addWindowController:xxx] method. My window controllers subclass from NSWindowController so I had to add my own instance variable to each window controller to hold the ManagedObjectContext, but I suspect that this isn't getting passed to the window/menu. Not sure what the normal pattern is here...
Anyway, any thoughts would be much appreciated. Thanks
From the description it sounds like your UI elements are not actually bound to the document itself. If so, then the UI elements are not observing the document and are not reacting to changes in the document. Check the bindings.
Thanks in part to TechZen, and also re-reading my own question (in particular, where I said "I suspect that it may have something to do with my window not knowing about my ManagedObjectContext") I started to look at the bindings for my WindowController subclass.
As it turned out, I hadn't bound the window outlet for the File's Owner to my actual NSWindow. As soon as I did that, the black dirty dot and the window's menus started behaving correctly.