Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Window.SetWindowIconMBS(Type as Integer, File as FolderItem, IconID as Integer) as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Windows MBS Win Plugin 7.4 No Yes No No No
Function: Sets the window icon using the icon in the file.
Example:
call window1.SetWindowIconMBS(0,getfolderitem("icon.ico"),1)
Notes:
Returns true on success and false on failure.
What image depths are used and supported depends on the Windows version.

Type is 0 for a small icon and 1 for a big icon.

See also:

Some examples which use this method:

Feedback, Comments & Corrections

Window.SetWindowIconMBS(Type as Integer, Icon as Picture, Mask as Picture) as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Windows MBS Win Plugin 7.4 No Yes No No No
Function: Sets the window icon using the given picture with mask.
Example:
dim p as Picture
dim m as Picture

// random colored circle image
p=NewPicture(16,16,32)
p.Graphics.ForeColor=&c000000
p.Graphics.FillRect 0,0,16,16
p.Graphics.ForeColor=rgb(rnd*256,rnd*256,rnd*256)
p.Graphics.Filloval 0,0,16,16

// circle mask
m=NewPicture(16,16,32)
m.Graphics.ForeColor=&cFFFFFF // transparent
m.Graphics.Fillrect 0,0,16,16
m.Graphics.ForeColor=&c000000 // color
m.Graphics.Filloval 0,0,16,16

Canvas1.Backdrop=p // show in canvas
Canvas2.Backdrop=m

call window1.SetWindowIconMBS(0,p,m)
Notes:
The mask picture ist converted to black/white.
What image depths are used and supported depends on the Windows version.
Returns true on success and false on failure.

Possible values for type:
ICON_BIG = 1Set the large icon for the window.
ICON_SMALL = 0Set the small icon for the window.

See also:

Some examples which use this method:

Feedback, Comments & Corrections

Window.SetWindowMaskMBS(p as picture, redraw as Boolean, transparentColor as color) as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Windows MBS Win Plugin 3.3 No Yes No No No
Function: Sets the mask of a window.
Notes:
Redraw decides whether the window is redrawn after it has been changed.
Returns true if successfull.

If you want to do the same on Mac OS X, check the example projects "transparent window" and the Photoshop Splash Screen example.

On Mac OS 9 you need a solution with a WDEF Resource which is not part of the plugin collection.

Some examples which use this method:

Feedback, Comments & Corrections

Window.WinAnimateWindowMBS(Flags as Integer, Time as Integer=200) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Windows MBS Win Plugin 9.4 No Yes No No No
Function: The AnimateWindow function enables you to produce special effects when showing or hiding windows.
Example:
dim flags as Integer

const AW_SLIDE = &h040000 // Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
const AW_ACTIVATE = &h020000 // Activates the window. Do not use this value with AW_HIDE.
const AW_BLEND = &h080000 // Uses a fade effect. This flag can be used only if hwnd is a top-level window.
const AW_HIDE = &h010000 //Hides the window. By default, the window is shown.
const AW_CENTER = &h10 // Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. The various direction flags have no effect.
const AW_HOR_POSITIVE = 1 // Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
const AW_HOR_NEGATIVE = 2 // Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
const AW_VER_POSITIVE = 4 // Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
const AW_VER_NEGATIVE = 8 // Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

window2.hide

flags=BitwiseOr(AW_SLIDE, AW_HOR_POSITIVE)

if window2.WinAnimateWindowMBS(flags, 1000) then
window2.show
else
MsgBox "Animatin failed."
end if
Notes:
There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.

self: The window to animate. The calling thread must own this window.
Time: Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
Flags: Specifies the type of animation. This parameter can be one or more of the following values. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a bitwiseor operator with the appropriate flags.

AW_SLIDE = &h040000Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
AW_ACTIVATE = &h020000Activates the window. Do not use this value with AW_HIDE.
AW_BLEND = &h080000Uses a fade effect. This flag can be used only if hwnd is a top-level window.
AW_HIDE = &h010000Hides the window. By default, the window is shown.
AW_CENTER = &h10Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. The various direction flags have no effect.
AW_HOR_POSITIVE = 1Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_HOR_NEGATIVE = 2Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_VER_POSITIVE = 4Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_VER_NEGATIVE = 8Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

Return Value:
If the function succeeds, the return value is true.
If the function fails, the return value is false.
The function will fail in the following situations:
  • If the window uses the window region. Windows XP: This does not cause the function to fail.
  • If the window is already visible and you are trying to show the window.
  • If the window is already hidden and you are trying to hide the window.
  • If there is no direction specified for the slide or roll animation.
  • When trying to animate a child window with AW_BLEND.
  • If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError returns ERROR_SUCCESS. To get extended error information, call the GetLastError function.

To show or hide a window without special effects, use Show.
When using slide or roll animation, you must specify the direction. It can be either AW_HOR_POSITIVE, AW_HOR_NEGATIVE, AW_VER_POSITIVE, or AW_VER_NEGATIVE.
You can combine AW_HOR_POSITIVE or AW_HOR_NEGATIVE with AW_VER_POSITIVE or AW_VER_NEGATIVE to animate a window diagonally.
The window procedures for the window and its child windows should handle any WM_PRINT or WM_PRINTCLIENT messages. Dialog boxes, controls, and common controls already handle WM_PRINTCLIENT. The default window procedure already handles WM_PRINT.
If a child window is displayed partially clipped, when it is animated it will have holes where it is clipped.
AnimateWindow supports RTL windows.
Avoid animating a window that has a drop shadow because it produces visually distracting, jerky animations.

Some examples which use this method:

Feedback, Comments & Corrections

Window.WinHideTooltipMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Windows MBS Win Plugin 16.1 No Yes No No No
Function: Hides all tooltips.
Notes:
You can call that in window.deactivate event to hide tooltips which did not hide themselves.
Returns number of hidden tooltips.

Feedback, Comments & Corrections

Window.WinTopMostWindowMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Windows MBS Win Plugin 9.6 No Yes No No No
Function: Whether a window is staying on the top of the other windows.
Example:
window1.WinTopMostWindowMBS=true
Notes:
If true the window stays in front of other windows. Default is false for Real Studio windows and true for overlays.
(Read and Write computed property)

Some examples which use this property:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.





Links
MBS Xojo blog