HELP FOR TEXPLORERBAR CLASS

HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sat Nov 20, 2010 10:03 am

LOOK THIS :
Image


HOW I CAN MODIFY THE HEIGHT BEETWEEN EACH OPTION OF MENU (ADDLINK)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sat Nov 20, 2010 10:38 am

Antonio,
I modified the methos addlink of TTaskPanel class

we can set nheight, nleft and font for each item

this method is compatible to old prg


Have you a suggestion ?
the code

Code: Select all  Expand view
METHOD AddLink( cPrompt,bAction, cBitmap,nheight,nleft,oFontItem ) CLASS TTaskPanel

   local nTop := ::nTitleHeight + 10, n, oUrlLink

    DEFAULT nHeight := 7
    DEFAULT nLeft := 33

    if oFontItem == nil
      oFontItem :=  ::oFont
   endif

   if ! Empty( ::aControls )
      for n = 1 to Len( ::aControls )
         nTop += ::aControls[ n ]:nHeight + nHeight
      next
   endif

   oUrlLink := TUrlLink():New( nTop, nLeft, Self, .T., .F., oFontItem, "", cPrompt )

   oUrlLink:SetColor( oUrlLink:nClrText, ::nClrPane )
   oUrlLink:nClrOver = ::nClrHover
   oUrlLink:bAction = bAction

   if File( cBitmap )
      oUrlLink:hBmp = ReadBitmap( 0, cBitmap )
   else
      oUrlLink:hBmp = LoadBitmap( GetResources(), cBitmap )
   endif

   if oUrlLink:nTop + oUrlLink:nHeight > ::nHeight
      ::nHeight = oUrlLink:nTop + oUrlLink:nHeight + 10
      ::nBodyHeight = ::nHeight - ::nTitleHeight
      ::UpdateRegion()
   endif

return nil







Image



NOW THE PROBLEM IS IT NOT REFRESH THE HEIGHT OF GROUP taskpanel have you an IDEA ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby ukoenig » Sat Nov 20, 2010 11:07 am

Works like LINEFEED :

Image

oPanel1 = oExBar:AddPanel( "One", "..\bitmaps\32x32\people.bmp" )
oPanel1:lSpecial = .T.
oPanel1:AddLink( "First item", bClick, "..\bitmaps\32x32\check.bmp" )
oPanel1:AddLink( "")
oPanel1:AddLink( "")
oPanel1:AddLink( "")

oPanel1:AddLink( "Second item", bClick, "..\bitmaps\32x32\edit.bmp" )
oPanel1:AddLink( "")
oPanel1:AddLink( "")
oPanel1:AddLink( "")

oPanel2 = oExBar:AddPanel( "Two", "..\bitmaps\32x32\case.bmp", 200 )
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sat Nov 20, 2010 11:31 am

yes this can be another solution

but how you think to modify the nleft and insert to the center the menu ?

the bitmaps are near to border of panel and the texts are on the top of menu
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sat Nov 20, 2010 11:36 am

UWE
look this

Image



How we can create it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby ukoenig » Sat Nov 20, 2010 11:46 am

Silvio,

I found a Solution, to show Buttons like displayed in Your Screenshot.
I will add a Sample as soon as possible.

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sat Nov 20, 2010 11:51 am

Why not try mine modifes on addlink and this topic viewtopic.php?f=3&t=20331 ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby ukoenig » Sat Nov 20, 2010 12:58 pm

Silvio,

it is very easy with no changes :

Image

Image

Image

Image

Image

some lines added and some changes in sample : explbar3.prg

Code: Select all  Expand view

#include "FiveWin.ch"
#include "ribbon.ch"
#include "xbrowse.ch"
#include "TTitle.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oExBar, oPanel1, oPanel2, oPanel3, oPanel4
   local bClick := { | o | MsgInfo( o:GetText() ) }
   local uVar, oBrw, oTitle1, oBtn1, oBtn2, oBtn3, oBtn4
   local aArray := { {"one",time(),DATE()},;
                  {"two",time(),DATE()},;
                  {"three",time(),DATE()},;
                  {"four",time(),DATE()},;
                  {"five",time(),DATE()} }
     
   DEFINE WINDOW oWnd TITLE "FWH Class TExplorerBar"
   
   oWnd:SetSize( 350, 600 )

   oExBar = TExplorerBar():New()

   oPanel1 = oExBar:AddPanel( "One", "..\bitmaps\32x32\people.bmp" )
   oPanel1:lSpecial = .T.
   oPanel1:AddLink( "First item", bClick, "..\bitmaps\32x32\check.bmp" )
   oPanel1:AddLink( "")
   oPanel1:AddLink( "")
   oPanel1:AddLink( "")  
   oPanel1:AddLink( "Second item", bClick, "..\bitmaps\32x32\edit.bmp" )
   oPanel1:AddLink( "")  
   oPanel1:AddLink( "")
   oPanel1:AddLink( "")  
   
   // -----------------

   oPanel2 = oExBar:AddPanel( "Two", "..\bitmaps\32x32\case.bmp", 140 )

   @ 25, -20  TITLE oTitle1 SIZE 350, 150 of oPanel2 NOBORDER SHADOW BOTTOMLEFT
   oTitle1:aGrdBack := { { 0.87,128,16046754 }, { 0.87,16046754,128 } }
   oTitle1:lRound := .F.

   @  15, 20 TITLEIMG oBtn1 OF oTITLE1 BITMAP "..\bitmaps\Alphabmp\Palm.bmp" TRANSPARENT ;
   REFLEX ANIMA LEVEL 255 ;
   ACTION MsgAlert( "Button with Action","Attention" ) 
     
  @  15, 90 TITLEIMG oBtn2 OF oTITLE1 BITMAP "..\bitmaps\Alphabmp\Video.bmp" TRANSPARENT ;
   REFLEX ANIMA LEVEL 255 ;
   ACTION MsgAlert( "Button with Action","Attention" ) 
   
   @  15, 170 TITLEIMG oBtn3 OF oTITLE1 BITMAP "..\bitmaps\Alphabmp\Pendrive.bmp" TRANSPARENT ;
   REFLEX ANIMA LEVEL 255 ;
   ACTION MsgAlert( "Button with Action","Attention" ) 

   @  15, 240 TITLEIMG oBtn4 OF oTITLE1 BITMAP "..\bitmaps\Alphabmp\Printer.bmp" TRANSPARENT ;
   REFLEX ANIMA LEVEL 255 ;
   ACTION MsgAlert( "Button with Action","Attention" ) 

    // ---------------------
   
   oPanel3 = oExBar:AddPanel( "Three", "..\bitmaps\32x32\case.bmp", 200 )
   @ 40,10 say "This a say" of oPanel3 transparent pixel
   @ 60,10 radio uVar prompt "This a radio" of oPanel3 pixel size 100, 25
   @ 90, 10 COMBOBOX uVar ITEMS { "one", "two", "three" } of oPanel3 size 100, 100 pixel
   @ 120, 10 RBBTN PROMPT "Ribbon Btn" of oPanel3 pixel size 100, 25 border transparent
   @ 160, 10 btnbmp PROMPT "BtnBmp" of oPanel3 pixel size 100, 25 border 2007
   @ 40, 120 xbrowse oBrw columns {1,2,3} array aArray of oPanel3  pixel size 180, 150
   oBrw:CreateFromCode()

    oWnd:oClient = oExBar

   ACTIVATE WINDOW oWnd

return nil
 


Best Regards
Uwe :lol:
Last edited by ukoenig on Sat Nov 20, 2010 10:15 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sat Nov 20, 2010 1:13 pm

Sorry I also see the menu near to the border and the text on the top of bitmap ....
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby ukoenig » Sun Nov 21, 2010 12:35 am

Moving the top Image to right direction :

Image

oPanel2 = oExBar:AddPanel( " Adjusted", "..\bitmaps\Alphabmp\A_1.bmp", 140 )
// -- Transparent --
// ----------------------
@ 35, -20 TITLE oTitle1 SIZE 350, 150 of oPanel2 ;
TRANSPARENT NOBORDER
// ---- Images ----
// ------------------
@ 10, 0 TITLEIMG oBtn1 OF oTITLE1 BITMAP "..\bitmaps\Alphabmp\A_2.bmp" TRANSPARENT ;
ANIMA LEVEL 255 ;
ACTION MsgAlert( "Button with Action","Attention" )
@ 40, 118 TITLETEXT OF oTITLE1 TEXT "Button 1" FONT oFont COLOR 128

@ 70, 0 TITLEIMG oBtn2 OF oTITLE1 BITMAP "..\bitmaps\Alphabmp\A_3.bmp" TRANSPARENT ;
ANIMA LEVEL 255 ;
ACTION MsgAlert( "Button with Action","Attention" )
@ 100, 118 TITLETEXT OF oTITLE1 TEXT "Button 2" FONT oFont COLOR 128


1. Open Pixelformer
2. Import the BMP
3. Copy BMP ( to memory )
4. Select Properties and change Size 100 x 32
5. make the complete area transparent ( erase old bmp )
6. select past and place the original BMP to the right hand side.
7. save the new BMP.

Image

Image

Best Regards
Uwe :lol:
Last edited by ukoenig on Sun Nov 21, 2010 1:32 pm, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: HELP FOR TEXPLORERBAR CLASS

Postby Daniel Garcia-Gil » Sun Nov 21, 2010 12:55 am

Uwe

Congratulation, you make amazing things

I like your work
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sun Nov 21, 2010 8:35 pm

sorry daniel

we must create a bmp big instead to create a new simply method ?

ahahahahahah

I thinked ... if I must use texplorerbar in this way I prefer not use this class
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby Silvio » Sun Nov 21, 2010 8:47 pm

Uwe,
use this modify please

it is compatible with old source

AddLink( cPrompt,bAction, cBitmap,nHeight,nLeft,oFontItem )



METHOD AddLink( cPrompt,bAction, cBitmap,nHeight,nLeft,oFontItem ) CLASS TTaskPanel

local nTop := ::nTitleHeight + 10, n, oUrlLink

DEFAULT nHeight := 7
DEFAULT nLeft := 33

if oFontItem == nil
oFontItem := ::oFont
endif

if ! Empty( ::aControls )
for n = 1 to Len( ::aControls )
nTop += ::aControls[ n ]:nHeight + nHeight
next
endif

oUrlLink := TUrlLink():New( nTop, nLeft, Self, .T., .F., oFontItem, "", cPrompt )

oUrlLink:SetColor( oUrlLink:nClrText, ::nClrPane )
oUrlLink:nClrOver = ::nClrHover
oUrlLink:bAction = bAction

if File( cBitmap )
oUrlLink:hBmp = ReadBitmap( 0, cBitmap )
else
oUrlLink:hBmp = LoadBitmap( GetResources(), cBitmap )
endif

if oUrlLink:nTop + oUrlLink:nHeight > ::nHeight
::nHeight = oUrlLink:nTop + oUrlLink:nHeight + 10
::nBodyHeight = ::nHeight - ::nTitleHeight
::UpdateRegion()
endif

return nil
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: HELP FOR TEXPLORERBAR CLASS

Postby ukoenig » Sun Nov 21, 2010 8:48 pm

Silvio,

don't be annoyed,
I think, Daniel only means the different VTitle-solutions using inside the Explorerbar.
The BMP-Size-adjust ist only a quick Solution with no changes of the Class,
to show the BMP on different horizontal Positions, but can be useful in some Situations.
I think, to define a horizontal start-position for the BMP's, is not a big Problem.

In method :

METHOD Paint() CLASS TExplorerBar // Bmp-part inside the Bar-section
and
METHOD Paint( nIndex ) CLASS TTaskPanel // Bmp-part inside the Panel-section

the Panel-BMP is calculated to a fixed Position :
minus 1/3 of BMP-height above Panel-top and minus 1/3 of BMP-width from left.
...
::aPanels[ n ]:nLeft - ( nBmpWidth( hBmpPanel ) / 3 ),;
::aPanels[ n ]:nTop - ( nBmpHeight( hBmpPanel ) / 3 ),;
...
...
to change this like using + 100, will move the BMP 100 Pixel from left to right
as well You have to change the Text-Position ( tested and works ! )

Best Regards
Uwe :lol:
Last edited by ukoenig on Sun Nov 21, 2010 11:36 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: HELP FOR TEXPLORERBAR CLASS

Postby ukoenig » Sun Nov 21, 2010 11:10 pm

Silvio,

I tested Your changes for the Link-section and it works fine here.

Image

oPanel1 = oExBar:AddPanel( "One", c_path + "\bitmaps\32x32\people.bmp", 100 )
oPanel1:lSpecial = .T.
oPanel1:AddLink( "First item", bClick, c_path + "\bitmaps\32x32\check.bmp", 30, 50, oFont )
oPanel1:AddLink( "Second item", bClick, c_path + "\bitmaps\32x32\edit.bmp", 30, 50, oFont )

Class-changes for the Panel-section :
( must be defined for Bar- and Panel-section )
Panel 1 nOrientation is different to Panel 2 ( same Value )
oExBar:nOrientation := 100
oPanel1:nOrientation := 100
oPanel2:nOrientation := 100
oExBar = TExplorerBar():New()
// New
oExBar:nOrientation := 100 // not defined, displays BMP at left Position

oPanel1 = oExBar:AddPanel( "One", c_path + "\bitmaps\32x32\people.bmp", 100 )
oPanel1:lSpecial = .T.
// New
oPanel1:nOrientation := 100 // not defined, displays BMP at left Position

Code: Select all  Expand view

CLASS TExplorerBar FROM TControl
// add  
DATA  nOrientation INIT 0

//---BMP-part of Panel area ( uses < nOrientation > Pixel from left ) ----//

METHOD Paint() CLASS TExplorerBar
...
...
// change
if ! Empty( ::aPanels )
  for n = 1 to Len( ::aPanels )
    if ! Empty( hBmpPanel := ::aPanels[ n ]:hBmpPanel )
      if ::aPanels[ n ]:lHasAlpha
        if ::nOrientation > 0
          ABPaint( ::hDC, ;
                ::aPanels[ n ]:nLeft + ::nOrientation, ;
                ::aPanels[ n ]:nTop - ( nBmpHeight( hBmpPanel ) / 3 ),;
                hBmpPanel, 255 )                
        else
           ABPaint( ::hDC, ;
                ::aPanels[ n ]:nLeft - ( nBmpWidth( hBmpPanel ) / 3 ),;
                ::aPanels[ n ]:nTop - ( nBmpHeight( hBmpPanel ) / 3 ),;
                hBmpPanel, 255 )        
        endif
    else
        if ::nOrientation > 0
          DrawTransparent( ::hDC,hBmpPanel, ::aPanels[n]:nTop-(nBmpHeight(hBmpPanel )/3),;
             ::aPanels[n]:nLeft + ::aPanels[ n ]:nOrientation )
        else
          DrawTransparent( ::hDC,hBmpPanel, ::aPanels[n]:nTop-(nBmpHeight(hBmpPanel)/3),;
             ::aPanels[n]:nLeft - (nBmpWidth( hBmpPanel)/3 ) )
        endif
      endif
    endif
  next
endif      
..
..
//--- BMP-part of Link area with Text ( uses < nOrientation > Pixel from left ) ---//

CLASS TTaskPanel FROM TControl
// add
DATA  nOrientation INIT 0
...
...
METHOD Paint( nIndex ) CLASS TTaskPanel
// change ( If You like, You can add some space between BMP and Text ==> + 10 )
if ::nOrientation > 0
   ::Say( 6, 15 + If( ! Empty( ::hBmpPanel ), + 10 + ::nOrientation, ::cTitle,;
   If( ::lSpecial, If( ::lOverTitle, ::nClrHover, ::nClrTextSpecial ),;
   If( ::lOverTitle, ::nClrHover, ::nClrText ) ),, ::oFont, .T., .T. )                    
else
   ::Say( 6, 15 + If( ! Empty( ::hBmpPanel ), + 10 + nBmpWidth( ::hBmpPanel ) / 2, 0 ), ::cTitle,;
   If( ::lSpecial, If( ::lOverTitle, ::nClrHover, ::nClrTextSpecial ),;
   If( ::lOverTitle, ::nClrHover, ::nClrText ) ),, ::oFont, .T., .T. )                      
endif
..
..
if ::lHasAlpha
   if ::nOrientation > 0
      ABPaint( ::hDC, ;
         ::nOrientation, ;
         - nBmpHeight( ::hBmpPanel ) / 3,;
         ::hBmpPanel, 255 )
   else
       ABPaint( ::hDC, ;
       - nBmpWidth( ::hBmpPanel ) / 3,;
       - nBmpHeight( ::hBmpPanel ) / 3,;
       ::hBmpPanel, 255 )
   endif
else
   if ::nOrientation > 0
     DrawTransparent( ::hDC, ::hBmpPanel, - nBmpHeight( ::hBmpPanel ) / 3,;
        ::nOrientation )
   else
      DrawTransparent( ::hDC, ::hBmpPanel, - nBmpHeight( ::hBmpPanel ) / 3,;
          - nBmpWidth( ::hBmpPanel ) / 3 )
   endif
endif  
...
...
 

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 82 guests