Error Scroll Panel class

Error Scroll Panel class

Postby Eoeo » Thu Aug 02, 2012 1:28 pm

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  Expand view
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

Postby Eoeo » Sun Oct 07, 2012 7:05 pm

Any solution ?
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: Error Scroll Panel class

Postby James Bott » Thu Feb 14, 2013 4:33 pm

Eoeo,

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

James

Code: Select all  Expand view
#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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Error Scroll Panel class

Postby nageswaragunupudi » Tue Feb 19, 2013 7:06 am

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  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 115 guests