Force system cursor usage in Flex - apache-flex

Let's say that you're using some black box library (i.e. no source code) that sets your cursor to something when rolling over a certain sprite. You can override that by catching rollOver and rollOut events, blocking propagation and using the CursorManager.
Question: is there a way to tell the CursorManager to use the system cursor?
Obviously, I could feed the CursorManager some "system like" cursor, but this would look weird if the local settings are different from that icon, which is likely to be always.
thank you!
f

You can create your own version of CursorManager - just create file mx/managers/CursorManager.as, copy it's content from default manager (use Ctrl+Shift+T to navigate to it) and change the code.
If you use RSLs then you need to create monkey-patch and load it BEFORE RSLs.
if you embed SDK into code then you can simply compile the app and class will be replaced.

Related

Build photo editor interface using Qt

I would like to create an application using Qt (PyQt5 specifically) that has a photo editor like interface. More specifically, I would like it to have:
No main window
Free-floating toolbar
Free-floating context window
Startup dialog
Edit-windows
The idea is to have the toolbar and context window persist for as along as the application is running. The user then opens one or multiple documents (e.g. images in the photo editor example) and uses the options in the toolbar to modify the document(s).
My first question is; does this type of application interface have a specific name, something akin to MDI or SDI? I've been searching for "photo editor interface" and variations on that, but haven't been able to find a search string that seems to hit the mark. For instance, I've tried "build a photo editor type interface with Qt" but it doesn't yield anything useful.
The second question I have is, what is the best way to build a Qt application that doesn't spawn a main window? It seems like I could kludge an assortment of dialogs together to make this happen, but I would really like to use a lot of the functionality of QMainWindow (toolbars, menus, top-level management of the application). Is there a way to launch QMainWindow, display the menu and toolbar, but suppress the main window?
I plan to primarily use this application on OSX, but would also like it to perform well on Windows and Linux.
QMenuBar has explicit support for OSX to have the menu bar behave as expected: http://doc.qt.io/qt-5/qmenubar.html#qmenubar-on-os-x
I think it'll also work on Ubuntu's Unity, which tries to have similar style, but there may be some details you need to take care of. Other desktops should work as expected.
As to how to have individual windows: any Qt widget will be a top level window if it has no parent, so that is an easy way to create windows. If you want to have parent windows (for example to control window stacking order automatically), there's a window flag for that. So you don't need to use QDialog (not sure if you were implying that in your question).
You want to read QWidget documentation carefully to get an idea how all this works.

libvlc_media_player_set_hwnd doesn't work with QWidget Handle

I am using Qt4.8 Windows version to develope an application to stream video using libvlc 2.2.1. When I use libvlc_media_player_set_hwnd() to render the video on my QWidget, its rather creating a separate window to display the video.
libvlc_media_player_set_hwnd(m_player, (void*)videoWidget->winId());
I have tried all versions of libvlc and all the examples related to libvlc with Qt. Also followed the steps given in https://wiki.videolan.org/LibVLC_SampleCode_Qt/
But I am not sure if I m missing anything.
It looks like as if libvlc_media_player_set_hwnd() is not able to take the QWidget WinId and creating its own window. However the value of (void*)videoWidget->winId() seems to be a valid one. (I got the value as 0x65).
Please let me know if I am missing anything.
You need to make sure you are configuring your VLC instance correctly first, so that it uses the dummy interface, for example:
/* Load the VLC engine */
std::vector<const char*> options;
options.push_back("--intf=dummy");
return libvlc_new(int(options.size()), options.data());
Also, are you sure you are passing the handle to the correct widget to render on? Also, make sure to set some size on the parent widget, otherwise you may not see anything render at all. Finally, check what media options you are setting to your media player instance, you may be inadvertently telling it to render to generated window.
I've been able to get VLC to work in my own Qt application using the following example as a starting point, even though it is for VLC 1.X:
LibVLC SampleCode Qt - VideoLAN Wiki

Adobe Extendscript Photoshop Guides Visibility

Is there a way via extendscript (jsx) to get the visibility status of Photoshop' guides?
The code to show and hide the guides is the same code as it 'toggles' the guides on or off so it must know the status when this code is executed, but how do I get at it?
I appreciate this could be done via a preference switch but that seems an awkward hack for something this simple, especially as something somewhere must be accessing this 'property' during execution of the 'toggle' code.
What would be great is to have activeDocument.guides.visible property, returning either true or false. Is there anything like that?
EDIT:
OK. Further investigation reveals that creating a guide using guides.add does not automatically toggle guides ON, however, using the code generated via the scriptListener does.
I would rather use guides.add as its only one line of code compared to fourteen so in order to toggle the guides to ON I thought I could run a function that created and then deleted a guide using the scriptListener code during the onLoad of the HTML.
This works great, except getting this function to run only when a document is opened is now the new problem.
documentAfterActivate is supposed to be the code to do this except it doesn't work unless a flash panel such as kuler is opened first.
So the question now is really what part of the flash code is allowing documentAfterActivate to work properly and how can I use it in my code instead of opening a flash panel I don't need?
It doesn't look like you've got a direct toggle option. You'd need to record the position of the guides somewhere and use script listener code to clear them when you wanted to toggle them off and use the add method on the Guides object to re-add them.
Keep in mind that even getting to the guide position via the photoshop DOM wasn't avail before CS4 I think? maybe CS5.
And i realised I just mis-read your question quite a bit. Anyway, this way you'd also know if the guides were visible based on whether or not they are there :) But yes, it isn't as nice as it could be.
The solution:
As stated, the workaround is to create and delete a guide with the fourteen lines of code from the scriptListener.
This toggles the guide visibility to ON regardless of its current state.
I can then save this status as a preference using putCustomOptions.
A function to do this is fired during the onLoad of the HTML but only when a document is opened otherwise guide creation fails.
documentAfterActivate does not work as expected unless a further flash panel (such as Kuler) is also opened beforehand.
An alternative to documentAfterActivate is to register the open event using CSevent instead.
The code can be found HERE.

Coded UI Testing in IE - How to upload a file?

With our CUIT tests in Visual Studio we have the problem that we cannot record the Browser Button action in IE. We just get:
C:\fakepath\Document1.txt
But this obviously does not lead to the real document in a playback. And it's not possible to just type the path into the Browse text field anymore.
Just FYI: This applies to the Coded UI Testing Framework in Visual Studio 2010 Feature Pack 2. The recorder only works with IE.
Any ideas?
Not being able to access the file upload control is supposed to be a security feature. I guess you need to step out of your environment and into the windows environment to accomplish anything.
If you use a macro recorder that can playback from command line (like http://www.jitbit.com/macro-recorder/versionhistory/) or a similar means, you may be able to record the missing step here (like a simple tab key hit - provided you have focused on the control before the upload control -, a typed text, and another tab key hit) and start the resulting "batch". Or you can even record a mouse click.
However, if this test runs in other browsers (if I understand you correctly), wouldn't it be safe enough to assume that it runs in IE as well, because after all you are using a standard control?
Actually, turns out I can edit the value "C:\fakepath\Document1.txt" manually in the uitest UIMaps file and change it to a real path. And it works in the reply like this.

flex - changing default cursor when executing copy on an item list

I am trying to change the default mouse cursor for a list drag and drop.
I was trying to get the COPY cursor using DragMananger and event.preventDefault()- but got a very weird cursor behavior (the items' drop indicator was wrongly presented - etc.) Therefor i am trying to stick to default - this works fine - but my cursor now on copy is a simple arrow, and i would like to get the arrow with the grin plus on it. How can i change the default?
Thanks!
There is lots of documentation on creating and using custom cursors with Flex. Here is my own blog post and podcast on the topic.
If you perform a Google Search, lots more info comes up.
If you need to change the dragImage, you can do so by setting the dragImage property on the DragManager.doDrag event. Google also provides a lot of info on changing the dragImage.

Resources