Alaska Software Inc. - Overwriting Menu Item
Username: Password:
AuthorTopic: Overwriting Menu Item
Carlos a Beling Overwriting Menu Item
on Tue, 10 Oct 2017 15:36:19 -0300
Good afternoon.
Please can someone tell me using Xbase++ 2.0 how to overwrite the menu 
item with a text in the current pointer position as the attached image?

Fraternally
Beling


Tip.gif
Jim LeeRe: Overwriting Menu Item
on Mon, 23 Oct 2017 17:12:44 +0200
> Please can someone tell me using Xbase++ 2.0 how to overwrite the menu
> item with a text in the current pointer position as the attached image?

try ModifyMenu function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms647993(v=vs.85).aspx
Carlos a Beling Re: Overwriting Menu Item
on Tue, 24 Oct 2017 13:14:22 -0200
Hello Jim:
again many thanks.
Good morning.
I tested with two types of menus: normal and Ownerdraw.
And if I am not wrong he problem that occur seems that the menus 
Presentation Spaces in Xbase++ 2.0 are diferent from the Presentation 
Space of AppDesktop() and AppDesktop():lockPS() because:

1) XbpStatic() using as parent AppDesktop() - that I understand that is 
the most top window - and using SetAppWidow() as owner does not 
overwrite the menu item, but overwrites its area in the AppDesktop() 
window and AppDesktop():lockPS().
2) XbpStatic() when is destroyed repaints the original area of the 
AppDesktop() and it's :lockPS() - as I understand must to be made.

3) XbpBitmap() overwrites both the menu item and AppDesktop() area and 
AppDeskTop():lockPS()
4) The tips shown in the item are not destroyed when new one item is 
selected and  each one showed remains painted until exiting the menu and 
the pointer moves over the Title Bar buttons, but they the tips shown 
are never destroyed in AppDesktop():lockPS()

5) GraStringAt(AppDesktop():lockPS(),...) works the same as XbpBitmap()

The attached image PS.png is the AppDesktop():lockps() save as 
XbbBitmap(). Please look at the BG of the image. It does not corresponds 
at the look of the appDesktop() (image Desk.png attached)


Fraternally
Beling

Em 23/10/2017 13:12, Jim Lee escreveu:
>> Please can someone tell me using Xbase++ 2.0 how to overwrite the menu
>> item with a text in the current pointer position as the attached image?
>
> try ModifyMenu function
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms647993(v=vs.85).aspx
>
>


Ps.png
Desk.png
Jim LeeRe: Overwriting Menu Item
on Tue, 24 Oct 2017 22:15:11 +0200
hi,

sorry i don't understand what you try

a "Top Window" are XbpDialog() / XbpCrt() which both have o:Menubar()
all Events are going to "Top Window"

it is not common to use AppDeskTop() as Parent for XbParts ... where do you
want send Event to ?
you can use AppDeskTop as Parent for "Common Controls" (have there own
Dialog Window) or o:PopUp() (own Thread)

> GraStringAt(AppDesktop():lockPS(),...) works the same as XbpBitmap()

the Windows Desktop is a Listview (SysListView32) but the Backgound Image is
a hBitmap

---

INLINE METHOD SetLogo(xValue)   set ListView Background Image
LOCAL oLogo

   IF PCOUNT() > 0
       use LVBKIMAGE Structure
      oLogo := LVBKIMAGE():new()

       must use LVBKIF_TYPE_WATERMARK only ?
      oLogo:ulFlags := LVBKIF_TYPE_WATERMARK

       load Image into hbm iVAR
      oLogo:hbm     := @user32:LoadImageA(AppInstance(),;
                                  MAKEINTRESOURCE(4000),;   load Resource
                                  IMAGE_BITMAP,;
                                  0    ,;
                                  0    ,;
                                  LR_CREATEDIBSECTION )

       Scale Factor
      oLogo:xOffsetPercent := 50
      oLogo:yOffsetPercent := 50

        now sending Structure to set Background Image
*     @user32:SendMessageA(::hLv, LVM_SETBKIMAGE, 0, oLogo)
      ::lv_SetBkImage(oLogo)   same as Macro
   ENDIF

RETURN self

p.s. at Pablos Website www.xbwin.com you can find a Xbase++ Wrapper for
WC_LISTVIEW (playing with the listview control,  ot4xb.public, 30. Mai
2011 ) Pablo have include all Structure, like LVBKIMAGE Structure, in ot4xb
so you can build your own native Control.

---

if you use a Backgound Image Slideshow you will find active Bitmap under

"C:\Users\%USER%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg"
Carlos a Beling Re: Overwriting Menu Item
on Wed, 25 Oct 2017 10:21:32 -0200
Hello Jim:
good morning.
Thanks again.
Please see below.
I submited an example of this problem to the Xbase++ Suport Team because 
this kind of problema that we are trying to solve may to interfere in 
other applications and may be must to be corrected or documented. I am 
waiting for an answer.

Fraternally
Beling

Em 24/10/2017 18:15, Jim Lee escreveu:
> hi,
>
> sorry i don't understand what you try
>
> a "Top Window" are XbpDialog() / XbpCrt() which both have o:Menubar()
> all Events are going to "Top Window"

I think that the parent of XbpDialog() / XbpCrt() must to be 
AppDesktop() and this way I can to create "Siblings" of the "top 
Wkindow" and, this way, I can use :clipsiblings := .t.. Am I correct?

>
> it is not common to use AppDeskTop() as Parent for XbParts ... where do you
> want send Event to ?

When I try to render a XpbStatic() with text that goes out of the "Top 
Window" and overlaps the AppDesktop(), the only way that I found for to 
accomplish it was set  AppDesktop() as parent of XbpStatic() and its 
owner the "Top Window" what makes XbpStatic() to become "sibling" of the 
"Top Wndow" this way XbpStatic() is working fine. Do you know if it has 
another way for to do it best?

> you can use AppDeskTop as Parent for "Common Controls" (have there own
> Dialog Window) or o:PopUp() (own Thread)
Ok
>
>> GraStringAt(AppDesktop():lockPS(),...) works the same as XbpBitmap()
>
> the Windows Desktop is a Listview (SysListView32) but the Backgound Image is
> a hBitmap

The trouble is to "destroy" the XbpBitmap() or GraStringAt()

>
> ---
Many thanks by the function I will to give it a try.
>
> INLINE METHOD SetLogo(xValue)   set ListView Background Image
> LOCAL oLogo
>
>     IF PCOUNT() > 0
>         use LVBKIMAGE Structure
>        oLogo := LVBKIMAGE():new()
>
>         must use LVBKIF_TYPE_WATERMARK only ?
>        oLogo:ulFlags := LVBKIF_TYPE_WATERMARK
>
>         load Image into hbm iVAR
>        oLogo:hbm     := @user32:LoadImageA(AppInstance(),;
>                                    MAKEINTRESOURCE(4000),;   load Resource
>                                    IMAGE_BITMAP,;
>                                    0    ,;
>                                    0    ,;
>                                    LR_CREATEDIBSECTION )
>
>         Scale Factor
>        oLogo:xOffsetPercent := 50
>        oLogo:yOffsetPercent := 50
>
>          now sending Structure to set Background Image
> *     @user32:SendMessageA(::hLv, LVM_SETBKIMAGE, 0, oLogo)
>        ::lv_SetBkImage(oLogo)   same as Macro
>     ENDIF
>
> RETURN self
>
> p.s. at Pablos Website www.xbwin.com you can find a Xbase++ Wrapper for
> WC_LISTVIEW (playing with the listview control,  ot4xb.public, 30. Mai
> 2011 ) Pablo have include all Structure, like LVBKIMAGE Structure, in ot4xb
> so you can build your own native Control.
>
> ---
>
> if you use a Backgound Image Slideshow you will find active Bitmap under
>
> "C:\Users\%USER%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg"
>
>
>
>
>
Carlos a Beling Re: Overwriting Menu Item - Solution
on Wed, 08 Nov 2017 15:34:13 -0200
Hello Jim:
good afternoon.

I received from the Alaska's Suport Team the answer below for to solve 
the problem.
May be it will be useful to everyone.
I tested it with the attached sample and it works fine.

<Suport_answer>
Your approach with using an XbpStatic object for displaying the tool tip 
is a good one; you need an object that you can place over the menu. 
However, technically Windows uses a so-called topmost window for 
displaying menus. This means that you need to also create a topmost 
window for being able to put your tool tips before the menu item.

Please try this:
1. Create a dialog with the size of the tool tip, set :topmost to .T.
2. Create an XbpStatic object inside the dialog
3. Use your existing logic to display the tool tip string inside the static
4. Destroy the dialog when done displaying your tool tip

Example:

oDlg := XbpDialog():new(AppDesktop(), SetAppWindow(), {nTipStartX, 
nTipStartY + aTipSize[02]},;
aTipSize )
oDlg:border:=XBPDLG_NO_BORDER
oDlg:titlebar := .F.
oDlg:alwaysOnTop := .T.
oDlg:create()

oStatic := XbpStatic():new(oDlg:drawingarea, SetAppWindow(), {0,0},;
aTipSize,;
{{XBP_PP_BGCLR , ::nColorBg},;
{XBP_PP_FGCLR , ::nColorTip},;
{XBP_PP_FONT, oPS:setFont()}})
oStatic:caption := cTip
oStatic:create()
(...)
</Suport_answer>


Fraternally
Beling

Em 24/10/2017 18:15, Jim Lee escreveu:
> hi,
>
> sorry i don't understand what you try
>
> a "Top Window" are XbpDialog() / XbpCrt() which both have o:Menubar()
> all Events are going to "Top Window"

I think that the parent of XbpDialog() / XbpCrt() must to be 
AppDesktop() and this way I can to create "Siblings" of the "top 
Wkindow" and, this way, I can use :clipsiblings := .t.. Am I correct?

>
> it is not common to use AppDeskTop() as Parent for XbParts ... where do you
> want send Event to ?

When I try to render a XpbStatic() with text that goes out of the "Top 
Window" and overlaps the AppDesktop(), the only way that I found for to 
accomplish it was set  AppDesktop() as parent of XbpStatic() and its 
owner the "Top Window" what makes XbpStatic() to become "sibling" of the 
"Top Wndow" this way XbpStatic() is working fine. Do you know if it has 
another way for to do it best?

> you can use AppDeskTop as Parent for "Common Controls" (have there own
> Dialog Window) or o:PopUp() (own Thread)
Ok
>
>> GraStringAt(AppDesktop():lockPS(),...) works the same as XbpBitmap()
>
> the Windows Desktop is a Listview (SysListView32) but the Backgound Image is
> a hBitmap

The trouble is to "destroy" the XbpBitmap() or GraStringAt()

>
> ---
Many thanks by the function I will to give it a try.
>
> INLINE METHOD SetLogo(xValue)   set ListView Background Image
> LOCAL oLogo
>
>     IF PCOUNT() > 0
>         use LVBKIMAGE Structure
>        oLogo := LVBKIMAGE():new()
>
>         must use LVBKIF_TYPE_WATERMARK only ?
>        oLogo:ulFlags := LVBKIF_TYPE_WATERMARK
>
>         load Image into hbm iVAR
>        oLogo:hbm     := @user32:LoadImageA(AppInstance(),;
>                                    MAKEINTRESOURCE(4000),;   load Resource
>                                    IMAGE_BITMAP,;
>                                    0    ,;
>                                    0    ,;
>                                    LR_CREATEDIBSECTION )
>
>         Scale Factor
>        oLogo:xOffsetPercent := 50
>        oLogo:yOffsetPercent := 50
>
>          now sending Structure to set Background Image
> *     @user32:SendMessageA(::hLv, LVM_SETBKIMAGE, 0, oLogo)
>        ::lv_SetBkImage(oLogo)   same as Macro
>     ENDIF
>
> RETURN self
>
> p.s. at Pablos Website www.xbwin.com you can find a Xbase++ Wrapper for
> WC_LISTVIEW (playing with the listview control,  ot4xb.public, 30. Mai
> 2011 ) Pablo have include all Structure, like LVBKIMAGE Structure, in ot4xb
> so you can build your own native Control.
>
> ---
>
> if you use a Backgound Image Slideshow you will find active Bitmap under
>
> "C:\Users\%USER%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg"
>
>
>
>
>


Test.zip