Alaska Software Inc. - grabox() queston
Username: Password:
AuthorTopic: grabox() queston
Carlos A Beling grabox() queston
on Fri, 16 Oct 2020 19:24:36 -0300
Good night.
I draw a box using Grabox(ops, ..., GRA_FILL, 9, 9) and I got the image 
!Box.png.
When I draw a box with rounded corners around it using Grabox(ops, ..., 
GRA_OUTLINE, 9, 9), the corners are square with a dark color. See the 
image !Drawed.png.
Please, what's going wrong?
<oPS> is obtained from a: drawingArea of an XbpDialog () whose parent is 
appDesktop ()

Fraternally
Beling


!Box.png
!Drawed.png
Jim LeeRe: grabox() queston
on Sat, 17 Oct 2020 01:50:13 +0200
hi,

when remember right only GRA_OUTLINEFILL work.
but Result is not very well ...

---

i have try GDI Funtion for "round Edge"

   @Gdi32:RoundRect(nhDC, rc[1],;
                          rc[2],;
                          rc[3],;
                          rc[2]+titleHeight,;
                          40 ,;
                          40)
but that is the Wrong Way

---

to get a "round" Button i do "mask" Region which will be Transparent

PROCEDURE MachKreise(oObj)
LOCAL hHwnd, aTmp, nLeftRect, nTopRect, nRightRect, nBottomRect, hRgn
LOCAL nFrame := GetSystemMetrics(SM_CYBORDER)

   hHwnd := oObj:GetHwnd()
   aTmp  := oObj:Currentsize()

   nLeftRect   := 0       +nFrame
   nTopRect    := aTmp[2] -nFrame
   nRightRect  := aTmp[1] -nFrame
   nBottomRect := 0       +nFrame

    now construct a Region and call its API function
   
   hRgn := CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
   SetWindowRgn(hHwnd,hRgn,.t.)

    clean up
   
   IF .NOT. EMPTY(hRgn)
       DeleteObject(hRgn)
   ENDIF

RETURN

DLLFUNCTION GetSystemMetrics( nIndex ) USING STDCALL FROM USER32.DLL
DLLFUNCTION CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect) 
USING STDCALL FROM GDI32.DLL
DLLFUNCTION SetWindowRgn(hHwnd,hRgn,bRedraw) USING STDCALL FROM USER32.DLL
DLLFUNCTION DeleteObject( hObject ) USING STDCALL FROM GDI32.DLL

so play with CreateEllipticRgn to get "round Edge" which look nice
Carlos A Beling Re: grabox() queston
on Tue, 20 Oct 2020 15:49:17 -0300
Hi Jim:
good afternoon.
Many thanks.
It works fine.
What I can not to understand is why Grabox(..., GRA_FILL, ...) works 
fine using oDlg:drawingArea and GraBox(..., GRA_OUTLINE, ...) and/or 
GraBox(..., GRA_OUTLINEFILL, ...) do not work.

Fraternally
Beling

On 16/10/2020 20:50, Jim Lee wrote:
> hi,
> 
> when remember right only GRA_OUTLINEFILL work.
> but Result is not very well ...
> 
> ---
> 
> i have try GDI Funtion for "round Edge"
> 
>     @Gdi32:RoundRect(nhDC, rc[1],;
>                            rc[2],;
>                            rc[3],;
>                            rc[2]+titleHeight,;
>                            40 ,;
>                            40)
> but that is the Wrong Way
> 
> ---
> 
> to get a "round" Button i do "mask" Region which will be Transparent
> 
> PROCEDURE MachKreise(oObj)
> LOCAL hHwnd, aTmp, nLeftRect, nTopRect, nRightRect, nBottomRect, hRgn
> LOCAL nFrame := GetSystemMetrics(SM_CYBORDER)
> 
>     hHwnd := oObj:GetHwnd()
>     aTmp  := oObj:Currentsize()
> 
>     nLeftRect   := 0       +nFrame
>     nTopRect    := aTmp[2] -nFrame
>     nRightRect  := aTmp[1] -nFrame
>     nBottomRect := 0       +nFrame
> 
>      now construct a Region and call its API function
>     
>     hRgn := CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
>     SetWindowRgn(hHwnd,hRgn,.t.)
> 
>      clean up
>     
>     IF .NOT. EMPTY(hRgn)
>         DeleteObject(hRgn)
>     ENDIF
> 
> RETURN
> 
> DLLFUNCTION GetSystemMetrics( nIndex ) USING STDCALL FROM USER32.DLL
> DLLFUNCTION CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
> USING STDCALL FROM GDI32.DLL
> DLLFUNCTION SetWindowRgn(hHwnd,hRgn,bRedraw) USING STDCALL FROM USER32.DLL
> DLLFUNCTION DeleteObject( hObject ) USING STDCALL FROM GDI32.DLL
> 
> so play with CreateEllipticRgn to get "round Edge" which look nice
> 
>
Jim LeeRe: grabox() queston
on Thu, 22 Oct 2020 01:56:03 +0200
hi,

> What I can not to understand is why Grabox(..., GRA_FILL, ...) works fine 
> using oDlg:drawingArea and GraBox(..., GRA_OUTLINE, ...) and/or 
> GraBox(..., GRA_OUTLINEFILL, ...) do not work.

"what" is GRA_* ... that is not a Windows Constant

Xbase++ GRA Functrion are "just" Wrapper for API Function and we do not have 
Source to look "inside"
Xbase++ do not use Windows API Constante so you just can guess what GRA_* 
Constant are using for.

you just can use Control as it is ... or write your own native Control
Carlos A Beling Re: grabox() queston
on Thu, 22 Oct 2020 09:45:25 -0300
Hi Jim.
Good day.
Many thanks.
I wrote Gra... refering to the Graphic functions.

Fraternally
Beling

On 21/10/2020 20:56, Jim Lee wrote:
> hi,
> 
>> What I can not to understand is why Grabox(..., GRA_FILL, ...) works fine
>> using oDlg:drawingArea and GraBox(..., GRA_OUTLINE, ...) and/or
>> GraBox(..., GRA_OUTLINEFILL, ...) do not work.
> 
> "what" is GRA_* ... that is not a Windows Constant
> 
> Xbase++ GRA Functrion are "just" Wrapper for API Function and we do not have
> Source to look "inside"
> Xbase++ do not use Windows API Constante so you just can guess what GRA_*
> Constant are using for.
> 
> you just can use Control as it is ... or write your own native Control
> 
> 
> 
> 
>
Andreas Gehrs-Pahl
Re: grabox() queston
on Wed, 21 Oct 2020 22:20:46 -0400
Carlos,

As always, please post a compilable program that creates the issue and 
information on your Xbase++ version. Without that, I can't reproduce your 
issue and can't help you with this.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Carlos A Beling Re: grabox() queston
on Fri, 23 Oct 2020 13:11:39 -0300
Hi Andreas.
Good day.
Many thanks again.
Fortunately I solved the problem.

Fraternaly
Beling

On 21/10/2020 23:20, Andreas Gehrs-Pahl wrote:
> Carlos,
> 
> As always, please post a compilable program that creates the issue and
> information on your Xbase++ version. Without that, I can't reproduce your
> issue and can't help you with this.
> 
> Andreas
>
Andreas Gehrs-Pahl
Re: grabox() queston
on Sat, 24 Oct 2020 15:30:16 -0400
Carlos,

>Fortunately I solved the problem.

Would you mind telling us what the solution was, in case someone else runs 
into a similar problem?

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Carlos A Beling Re: grabox() queston
on Tue, 27 Oct 2020 10:50:49 -0300
Hi Andreas:
good day.
I wrote a function for showing tips over menu items using ideas from Jim.
Please see the attach file that is a snipet of the function that I used.
If you want I can post the complete function.

Fraternally
Beling


On 24/10/2020 16:30, Andreas Gehrs-Pahl wrote:
> Carlos,
> 
>> Fortunately I solved the problem.
> 
> Would you mind telling us what the solution was, in case someone else runs
> into a similar problem?
> 
> Andreas
>


Example.prg
Jim LeeRe: grabox() queston
on Tue, 27 Oct 2020 22:55:10 +0100
hi,

"how" to you active Tooltip ?

did you use XbpWindow():tooltipText Slot ?
Carlos A Beling Re: grabox() queston
on Wed, 28 Oct 2020 13:02:12 -0300
Hi Jim:
Good day.
I use:
    ::oMenu:itemMarked := {|nItemIndex| ShowMenuTip_(::Tips[nItemIndex], 0)}
    ::oMenu:endMenu    := {|| HideMenuTip_()}

STATIC oMenuTip

FUNCTION ShowMenuTip_(cTip, nWait)
        Função para exibir as tips de menus.
                <cTip> -> tip
                <nWait> -> waiting time (centsof seconds) for to show 
the tip
        Retorns NIL
if oMenuTip == NIL
    oMenuTip := CabMenuTip_():new()  UDF
endif

if !Empty(cTip)
    oMenuTip:show(cTip, nWait)
else
    oMenuTip:hide()
endif
RETURN NIL

FUNCTION HideMenuTip_()
        Retorns NIL
if oMenuTip <> NIL
    oMenuTip:hide()
endif
RETURN NIL

If you want I post the class CabMenuTip_() as you want.

Fraternally
Beling



On 27/10/2020 18:55, Jim Lee wrote:
> hi,
> 
> "how" to you active Tooltip ?
> 
> did you use XbpWindow():tooltipText Slot ?
> 
>