vba power point changing image border color on click - image

I'm trying to make an educational interactive presentation for kinder children using Power Point, and I'm trying to do a kind of test/activity in which the children have to click on some pictures according to the question. Some will be right, some don't. (for instance: can you point the tools used by a fireman? and show 4 images of different tools)
Using the mousemove event, I can reproduce a sound that says the name of the object, and using the click event I can reproduce another sound to tell the children "wrong" or "right".
Now, I would like to change the border of the picture they are clicking on (color and or width), but I have no clue how to do it in VBA.
It must be very easy, but I don't know the sintax :-(
Any help? Please?
Thank you!

You would be surprised but it's not so easy as you expected, of course, when doing smartly with classes and events.
I'll give you simple idea, so if you have time and really need it you could go this way. But there would be some problems- you will have to figure out how could you get starting borders of your shapes.
Here is idea how to start.
name each of the shape on the slide- select one and run the following instruction in Immediate window in VBA editor, eg.:
ActiveWindow.Selection.ShapeRange.Name = "Fireman"
to change the color and line write macro for each shape (this will run only in slideshow view):
Sub FiremanClick()
With SlideShowWindows(1).View.Slide.Shapes("Fireman").Line
.Weight = 2
.ForeColor.RGB = RGB(255, 0, 0)
End With
End Sub
in application right-click fireman shape and associate action with macro you wrote.
you will need to figure out how to set back standard setting of each shape and when.

For some reason, some kind of bug happens when setting the border shape color first and then the weight, the shape border color becomes the generic blue one in PowerPoint 2010.

Related

Create pop menu Sims's style when click on Character in Unity3D

I'm trying to build a game that uses a concept from the known game "The Sims". Right now I'm building the AI for a 3d Character, and I need the player to be able to tell where the character should go or do. I want to know the best ways to create a pop up menu with animations, kind of to show some choices, so that when the player clicks over the 3d Character he can pick wherever he wants to do. I know this must be using UI elements under a Canvas that's placed over the player. However I can not have 2 Canvas in a Scene and I don't know how to fix them to the character so that it moves with him. Thanks in advance.
Here you can see what I mean, this is the Sims Game
You have two main approaches here:
1) Use a world space UI.
2) Use a screen space UI and position it in real time using a worldspace to screen space transformation.
Both of these topics will expand substantially when you approach them, so it's not possible to give any more specifics from here.
Having played the Sims a bit before though, I would suggest you use a world space UI system if you're chasing the same style as them.
You can have as many canvases as you want. To control levels of canvases (which one is on top) you use "Order in Layer" parameter in "Canvas" component of your chosen Canvas. The lower the number is the higher interactivity and visibility your canvas has.
You can create one canvas ant parent it to you character. AS the canvas will be smaller your should play with these parameters to get the resolution you want (don't over do it):
To make canvas always facing the camera you should give Canvas a new script, with a command:
canvas.transform.LookAt(camera.transform);
To control canvas' visibility you may use this code line:
canvas.enabled = bool;
Where bool is false when you want to hide it and bool is true when you want to show it.
In the "Sims" the visibility comes with animation which you may do also, but I would leave it after I did all the functionality.

How to change orientation of sketch in CATIA using VB/Knowledgeware?

I am trying to create a knowledge template, such that when I choose a string value from a dropdown list of a multiple value parameter, the reaction fires according to the selection. For example, if I select "no cut", no pocket features are created. (or deleted if they already exist) If I select "top cut", a predefined sketch is used to drive the pocket feature. However, where I'm stuck, is that I want to define a "bottom cut" by changing the orientation of a positioned sketch. I envision it like this:
"bottom cut" selected from drop down list
change sketch support would be initiated
"Reverse V" would be
selected
sketch would be flipped around the xy plane
If "both top and bottom cut" is selected, it would return the sketch to top position (uncheck "Reverse V") and mirror the resultant pocket around XY
I have managed to accomplish everything but the "Reverse V" of "Change Sketch Support". No idea at all what is the best way to accomplish this.
So far, I've created both Knowledgeware actions, and VB actions. Open to any and all suggestions on this one.
Thank you.
Regarding that API for flipping objects orientation are not available, I suggest that you base your sketch orientation on a feature that can be easily flipped:
Create a line based on two "coordinates" points
Use positioned sketch and specify the support plane, the origin point, and orientation for the V direction by using the previously created line
You can now control the points coordinates to change the orientation of the line, and the sketch will follow.
The code will be simple, and the solution is very stable.
Assuming that the reference line is based on two points {0,0,0} and {x,0,0}, the code would be
if TopOrientation
{
GeoSet1\RefPoint\X=1mm
}
else
{
GeoSet1\RefPoint\X=-1mm
}
I hope it will help you.

Cocoa: Custom control not limited to window frame - how to start?

I want to build a custom control that would work like this:
You have a kind of NSButton with an image.
You click the button and than appears a big square with a grid of photos.
You click one of the photos and it is set up as new image for the button. (square dissapears)
Now, how to draw this big square with photos if I want it not to be limited to window frame?
I mean, if the button was close to window border the square is going to be partially outside window. I would also like to add some shadow to the square and an animation for opening/closing.
One important thing: I want to be able to draw not only a square but any other simple shape (circle)!
This isn't really a drawing question so much as a general custom views question. It's important to make that distinction.
I'll describe this in terms of rectangles to give you the general idea*. You should make sure you understand the view hierarchy and view geometry in Cocoa. Without this important requisite knowledge, you'll remain dead in the water.
It's easy to set an NSButton's image, so I'll leave that to you. Your button's action, however, would tell some controller to show the "image picker" for the given button. Your image picker would be some type of borderless window with an image list inside. The image picker could be an IKImageBrowserView (you'll have to enable Image Kit in Interface Builder for this control to appear), which gives you an iPhoto-like grid of images (with/without titles, different border types, etc.).
An explanation of the operation of this controller and how it creates the window, manages the selection, and sets the button's image is very broad so if you get hung up on any of those steps, you'll need to create a separate question for each problem, otherwise this answer would have to be an instruction manual for writing your app for you.
* Your problem is a little more difficult because of your desire to have differently-shaped "popup windows" ... you'd have to make sure your available photos fit neatly within the shape so none of them are cut off. Armed with the basic knowledge of view geometry, I'll leave this to you as an exercise. A hint: you can use a borderless, transparent window to host a view that draws itself in any shape you please.

Qt - Drawing a Rect/Frame out of a bigger Pixmap image

I've been banging my head about this seemingly easy task and I could really use some help.
I have a wide Image loaded in the gui (using the designer..) and I want to be able to draw only a portion of it, a rectangle.
I need to be able to change this rectangle position over the large image, in order to draw a different part of the larger image at will. In this process the rect must maintain its size.
Using the Ui::MainWindow object I'm able to access the label holding the image and a solution that involves using this option is preferred (in order to keep up with the rest of the code I've already written )
Any solution will be much appreciated :)
Thanks,
Itamar
I would definitely (for ease of use) just place an empty label as placeholder in Designer.
Then implement the paintEvent for this label (delegate it to your own method). You'll have also have to look into QPainter, QPixMap, etc... Should be doable based on these hints and the documentation.
If you want more, I suggest you provide a small code snippet to work upon.
If you want to do this more or less purely through designer, you could put a QScrollArea where you want the portion of the image to appear. If you set the scroll area's scrollbar policy to be never shown, you can then manually change what part is visible via the scroll area widget. However, this would probably be more complex that creating a derived widget and reimplementing the paint function.

VB6 PictureBox Mouseover

I'm using a VB6 PictureBox on my User Control. I set the PictureBox's picture, I set the BorderStyle to 0, and I set the BackColor to the User Control's BackColor. The idea is that I want a "floating" icon. However, I want that icon to appear clickable when the mouse hovers over it.
Two questions:
Which events do I use? MouseMove seems to be the closest to a "MouseOver" event. Are there any cleaner alternatives?
How should I change the style? I've tried a few things, but none of them quite look right.
MouseMove is the correct event in VB6. You'll have to do some work to manually detect when the mouse leaves the client area cleanly. (My experiments in this world, lo those many years ago, always found implementing this behavior to be tricky.)
For changing the style, I'd recommend using GDI to: (a) shift the image one pixel up and to the left; (b) draw a single pixel line in the ButtonHighlightColor along the top and left edges; and (c) draw a single pixel line in the ButtonShadowColor along the bottom and right edges. This is trickier than it sounds, particularly in VB6, so ultimately I'd recommend ...
That you look at vbAccelerator's toolbar controls. They're free, and they'll probably get you most of where you want to be. (And yes, they're "classic" VB -- that is, VB6.)

Resources