Error with scrollpanel class

Error with scrollpanel class

Postby Silvio.Falconi » Fri Jun 19, 2015 5:07 pm

I have this error

Code: Select all  Expand view
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: Select all  Expand view

#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm

Re: Error with scrollpanel class

Postby nageswaragunupudi » Sun Jun 21, 2015 2: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
User avatar
nageswaragunupudi
 
Posts: 10347
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Error with scrollpanel class

Postby Silvio.Falconi » Sun Jun 21, 2015 7:06 pm

thanks I understood
but not run I not see the image I selected

Code: Select all  Expand view
#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm

Re: Error with scrollpanel class

Postby Silvio.Falconi » Sun Jun 21, 2015 7: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: Select all  Expand view
#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm

Re: Error with scrollpanel class

Postby Antonio Linares » Sun Jun 21, 2015 9:42 pm

Silvio,

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

Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error with scrollpanel class

Postby Antonio Linares » Sun Jun 21, 2015 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error with scrollpanel class

Postby Daniel Garcia-Gil » Sun Jun 21, 2015 11:40 pm

Hello

Code: Select all  Expand view

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
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Error with scrollpanel class

Postby Antonio Linares » Mon Jun 22, 2015 6:05 am

Daniel,

Genial como de costumbre ;-)

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

Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error with scrollpanel class

Postby Silvio.Falconi » Mon Jun 22, 2015 8:14 am

uauuu fantastic
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests