Error Scroll Panel class

Post Reply
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Error Scroll Panel class

Post by Eoeo »

I made a test

static oPanel
Function Main()
Local oPanel,oBrush,oWnd
DEFINE BRUSH oBrush FILENAME "mare.bmp"
DEFINE WINDOW oWnd
oPanel:= TScrollPanel():New(40,2,400,400,oWnd)
oPanel:SetBrush(oBrush)
oWnd:oclient:=oPanel
ACTIVATE WINDOW oWnd maximized

Return nil



let me give this error

Code: Select all

Application
===========
   Path and name: C:\Work\Errori\ScrollPanel\test.Exe (32 bits)
   Size: 1,816,576 bytes
   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
   FiveWin  Version: FWHX 12.03
   Windows version: 6.1, Build 7600 

   Time from start: 0 hours 0 mins 1 secs 
   Error occurred at: 08/02/12, 15:26:16
   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 => (b)TSCROLLPANEL:TSCROLLPANEL( 46 )
   Called from:  => TSCROLLPANEL:GOTOP( 0 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:VSCROLL( 295 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TSCROLLPANEL:HANDLEEVENT( 1700 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3153 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 426 )
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 31 )
   Called from:  => NTOP( 0 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:VSETPOS( 190 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:RESIZE( 119 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TSCROLLPANEL:HANDLEEVENT( 1700 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3153 )
   Called from:  => WNDHEIGHT( 0 )
   Called from: .\source\classes\CONTROL.PRG => (b)TCONTROL:TCONTROL( 192 )
   Called from:  => TSCROLLPANEL:_NHEIGHT( 0 )
   Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:CHECKRESIZE( 140 )
   Called from: .\source\classes\SCRLPANL.PRG => (b)TSCROLLPANEL:NEW( 110 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:RESIZE( 2134 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3153 )
   Called from:  => SHOWWINDOW( 0 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 963 )
   Called from: test.prg => MAIN( 21 )
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: Error Scroll Panel class

Post by Eoeo »

Any solution ?
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Error Scroll Panel class

Post by James Bott »

Eoeo,

You can't use the oWnd object until it is actually initialized in ACTIVATE WINDOW. Try the code below:

James

Code: Select all

#include "fivewin.ch"


Function Main()
   Local oPanel,oBrush,oWnd
   DEFINE BRUSH oBrush FILENAME "mare.bmp"
   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd maximized on init(oBrush,oPanel)
Return nil

function createPanel(oBrush,oPanel)
   oPanel:= TScrollPanel():New(40,2,400,400,WndMain())
   oPanel:SetBrush(oBrush)
   WndMain():oClient:=oPanel
return nil
 
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Error Scroll Panel class

Post by nageswaragunupudi »

The scroll panel should have atleast one control.
Real use of scroll panel is when the controls in the panel exceed the height of the panel/window.

After creating the scroll panel, you should create atleast one control in the panel and after creating all controls it is necessary that you should call oPanel:SetRange().

Your program modified looks like this:

Code: Select all

static oPanel

Function Main()

Local oPanel,oBrush,oWnd, C := 'HELLO'

   DEFINE BRUSH oBrush FILENAME "clouds1.bmp"
   DEFINE WINDOW oWnd
   oPanel:= TScrollPanel():New(40,2,400,400,oWnd)
   oPanel:SetBrush(oBrush)
   @ 10,10 GET C OF oPanel SIZE 100,20 PIXEL
   oPanel:SetRange()

//   oWnd:oclient:=oPanel
   ACTIVATE WINDOW oWnd maximized

Return nil
 
Real use of scroll panel is only when you have many controls exceeding the height of the scroll panel.
Regards

G. N. Rao.
Hyderabad, India
Post Reply