FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Error with scrollpanel class
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Error with scrollpanel class
Posted: Fri Jun 19, 2015 05:07 PM
I have this error

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Work\Errori\scrollPanel\test.Exe (32 bits)
   Size: 2,618,368 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
   FiveWin  Version: FWHX 15.01
   Windows version: 6.1, Build 7600 

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 06/19/15, 19:06:24
   Error description: Error BASE/1004  Class: 'NIL' has no exported method: NTOP
   Args:
     [   1] = U   

Stack Calls
===========
   Called from:  => NTOP( 0 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:VSETPOS( 196 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:RESIZE( 124 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TSCROLLPANEL:HANDLEEVENT( 1733 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
   Called from:  => WNDHEIGHT( 0 )
   Called from: .\source\classes\CONTROL.PRG => (b)TCONTROL:TCONTROL( 184 )
   Called from:  => TSCROLLPANEL:_NHEIGHT( 0 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:CHECKRESIZE( 145 )
   Called from: .\source\classes\SCRLPANL.PRG => (b)TSCROLLPANEL:NEW( 115 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:RESIZE( 2357 )
   Called from: .\source\classes\DIALOG.PRG => (b)TDIALOG:TDIALOG( 92 )
   Called from:  => TDIALOG:RESIZE( 0 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 906 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 286 )
   Called from: test.prg => TEST( 22 )

System



I made a small sample test to try

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "constant.ch"


static oDlg,oPanel,oImage


Function test()
   Local nBottom   := 33
   Local nRight    := 75
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H

  DEFINE DIALOG oDlg  ;   //
   TITLE "test"   ;
   SIZE nWidth, nHeight  TRANSPARENT PIXEL

    oDlg:nStyle    := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX,   0  )


   ACTIVATE DIALOG oDlg CENTERED ;
     ON INIT (Create_Panel(), Create_Image() )
return nil 

//--------------------------------------------------------------------------------------//
Function Create_Panel()
   oPanel:=TScrollPanel():New( 0, 0,oDlg:nHeight-80 ,oDlg:nWidth-20, oDlg )
   oPanel:setrange()
  return nil
//--------------------------------------------------------------------------------------//
Function Create_Image()
   @ 0, 0 IMAGE oImage SIZE oPanel:nRight, oPanel:nbottom OF  oPanel
   oImage:nWidth:= oPanel:nWidth
   oImage:nHeight:= oPanel:nHeight
   oImage:center()
return nil
//--------------------------------------------------------------------------------------//
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Error with scrollpanel class
Posted: Sun Jun 21, 2015 02:01 AM

You should call oPanel:SetRange() only after you create all controls on the panel.
You may revise your code accordingly.

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Error with scrollpanel class
Posted: Sun Jun 21, 2015 07:06 PM
thanks I understood
but not run I not see the image I selected

Code (fw): Select all Collapse
#include "constant.ch"


static oDlg,oPanel,oImage


Function test()
   Local nBottom   := 33
   Local nRight    := 75
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H

  DEFINE DIALOG oDlg  ;   //
   TITLE "test"   ;
   SIZE nWidth, nHeight  TRANSPARENT PIXEL

    oDlg:nStyle    := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX,   0  )


   ACTIVATE DIALOG oDlg CENTERED ;
     ON INIT (Create_Panel(), Create_Image(),GetImage( oImage )  )
return nil

//--------------------------------------------------------------------------------------//
Function Create_Panel()
   oPanel:=TScrollPanel():New( 0, 0,200 ,oDlg:nWidth-20, oDlg )
  * oPanel:setrange()
  return nil
//--------------------------------------------------------------------------------------//
Function Create_Image()
   @ 0, 0 IMAGE oImage SIZE oPanel:nRight, oPanel:nbottom OF  oPanel
   oImage:nWidth:= oPanel:nWidth
   oImage:nHeight:= oPanel:nHeight
   oImage:center()

return nil
//--------------------------------------------------------------------------------------//

 STATIC FUNCTION GetImage( oImage )

   local gcFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" +         ;
                             "DIB   (*.dib)| *.dib|" +          ;
                             "PCX   (*.pcx)| *.pcx|"  +         ;
                             "JPEG  (*.jpg)| *.jpg|" +          ;
                             "GIF   (*.gif)| *.gif|"  +         ;
                             "TARGA (*.tga)| *.tga|" +          ;
                             "RLE   (*.rle)| *.rle|" +          ;
                             "All Files (*.*)| *.*"             ;
                            ,"Please select a image file", 4 )

   if ! Empty( gcFile ) .and. File( gcFile )
      oImage:LoadBmp( gcFile )
         oImage:refresh()
        oPanel:setrange()

   endif
return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Error with scrollpanel class
Posted: Sun Jun 21, 2015 07:28 PM
Now I see the image
but when I move the dialog the scrollpanel is resize but the image that is on the center not resize
how resolve it ?
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "constant.ch"


static oDlg,oPanel,oImage


Function test()
   Local nBottom   := 33
   Local nRight    := 75
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H

  DEFINE DIALOG oDlg  ;   //
   TITLE "test"   ;
   SIZE nWidth, nHeight  TRANSPARENT PIXEL

    oDlg:nStyle    := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX,   0  )


     oDlg:bResized := {||Rinfresca_oFrm() }




   ACTIVATE DIALOG oDlg CENTERED ;
     ON INIT (Create_Panel(), Create_Image(),GetImage( oImage )  )
return nil

//--------------------------------------------------------------------------------------//
Function Create_Panel()
   oPanel:=TScrollPanel():New( 0, 0,oDlg:nbottom-200 ,oDlg:nWidth-20, oDlg )
  * oPanel:setrange()
  return nil
//--------------------------------------------------------------------------------------//
Function Create_Image()
   @ 0, 0 IMAGE oImage SIZE oPanel:nRight, oPanel:nbottom OF  oPanel  // SCROLL ADJUST

   oImage:Progress( .f. )
return nil
//--------------------------------------------------------------------------------------//

 STATIC FUNCTION GetImage( oImage )

   local gcFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" +         ;
                             "DIB   (*.dib)| *.dib|" +          ;
                             "PCX   (*.pcx)| *.pcx|"  +         ;
                             "JPEG  (*.jpg)| *.jpg|" +          ;
                             "GIF   (*.gif)| *.gif|"  +         ;
                             "TARGA (*.tga)| *.tga|" +          ;
                             "RLE   (*.rle)| *.rle|" +          ;
                             "All Files (*.*)| *.*"             ;
                            ,"Please select a image file", 4 )

   if ! Empty( gcFile ) .and. File( gcFile )
      oImage:LoadBmp( gcFile )
        oPanel:setrange()

   endif
   return nil

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


Function Rinfresca_oFrm()

  oPanel:nWidth:=oDlg:nWidth-20
  oPanel:nHeight:=oDlg:nbottom-200
  oPanel:refresh()

   oImage:nWidth:= oPanel:nWidth
   oImage:nHeight:= oPanel:nHeight
   oImage:nZoom:= 1
   oImage:center()
   oImage:refresh()


   return ni
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error with scrollpanel class
Posted: Sun Jun 21, 2015 09:42 PM
Silvio,

I am trying this but I gert amazing results :-)

Code (fw): Select all Collapse
Function Rinfresca_oFrm()

  local lGrow := oDlg:nWidth - 20 > oPanel:nWidth

  oPanel:nWidth:=oDlg:nWidth-20
  oPanel:nHeight:=oDlg:nbottom-200
  // oPanel:refresh()

   oImage:hBitmap = ResizeBmp( oImage:hBitmap, oImage:nWidth * If( lGrow, 1.02, 0.98 ),;
                             oImage:nHeight * If( lGrow, 1.01, 0.98 ), .T. )    
   oImage:SetSize( oPanel:nWidth, oPanel:nHeight )  
   oImage:center()
   // oImage:refresh()


   return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error with scrollpanel class
Posted: Sun Jun 21, 2015 09:44 PM

I am going to ask Daniel for help, surely he will solve it as he is very good on mathematics :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Error with scrollpanel class
Posted: Sun Jun 21, 2015 11:40 PM
Hello

Code (fw): Select all Collapse
Function Rinfresca_oFrm()

  oPanel:SetSize( oDlg:nWidth-20, oDlg:nbottom-200 )  

  // oPanel:refresh()

  if oImage:cargo == NIL
    oImage:cargo = oImage:hBitmap
  else
    DeleteObject( oImage:hBitmap )
  endif

   oImage:hBitmap = ResizeBmp( oImage:cargo, oPanel:nWidth, oPanel:nHeight, .T. )    
   oImage:SetSize( oPanel:nWidth, oPanel:nHeight )  
   oImage:center()
   // oImage:refresh()


   return nil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error with scrollpanel class
Posted: Mon Jun 22, 2015 06:05 AM
Daniel,

Genial como de costumbre :-)

A mi me funciona tu código con este pequeño cambio:

Code (fw): Select all Collapse
function Rinfresca_oFrm()

   oPanel:SetSize( oDlg:nWidth-20, oDlg:nbottom-200 )  

   if oImage:cargo == NIL
      oImage:cargo = oImage:hBitmap
   else
      DeleteObject( oImage:hBitmap )
   endif

   oImage:hBitmap = ResizeBmp( oImage:cargo, oPanel:nWidth, oPanel:nHeight, .T. )    
   oImage:SetSize( oPanel:nWidth, oPanel:nHeight )  
   oImage:Center()
   oImage:Refresh()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Error with scrollpanel class
Posted: Mon Jun 22, 2015 08:14 AM

uauuu fantastic

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion