Page 1 of 1

PANEL - new window type

Posted: Wed Apr 28, 2010 8:01 am
by l3whmg
Hi friends,
I've tried to read about this new window type and it's use, but...
First of all I don't understand if I can use this new window type inside CHILD form.
After this, I've tried to use it but I receive an error during execution of my code.

I've included a sample prg and an error screenshot. I've defined/used form (with panel) one time as CHILD and one time as MODAL, but the error it's the same.

Many thanks in advantage

Re: PANEL - new window type

Posted: Wed Apr 28, 2010 8:55 am
by gfilatov
l3whmg wrote:Hi friends,
I've tried to read about this new window type and it's use, but...
First of all I don't understand if I can use this new window type inside CHILD form.
...
Many thanks in advantage
Hi,

Please try the following working sample with CHILD form usage:

Code: Select all

#include "hmg.ch"

FUNCTION main()

p000_Define()
p001_Define()
ACTIVATE WINDOW p001win, p000win
RETURN NIL

/************************************************************
* Main form definition
************************************************************/
STATIC FUNCTION p000_Define()
DEFINE WINDOW p000win ;
 AT 0,0 ;
 WIDTH 860 ;
 HEIGHT 645 ;
 TITLE 'Panel tester' ;
 WINDOWTYPE MAIN ;
 FONTNAME "Arial" FONTSIZE 12

 DEFINE MAIN MENU
  DEFINE POPUP '&File'
   MENUITEM 'e&Xit' ACTION p000win.Release
  END POPUP
  DEFINE POPUP '&Open Form'
   MENUITEM '&Do' ACTION p000_OpenForm()
  END POPUP
 END MENU

END WINDOW
p000win.Center
RETURN NIL

/************************************************************
* Sub (and panel) form definition
************************************************************/
STATIC FUNCTION p001_Define()
DEFINE WINDOW p001win ;
 AT 0,0 ;
 WIDTH 700 ;
 HEIGHT 525 ;
 TITLE 'Sub Form' ;
 WINDOWTYPE CHILD ;
 NOAUTORELEASE ;
 ONINIT p001win.Hide ;
 FONTNAME "Arial" FONTSIZE 12

 DEFINE TOOLBAR toolbar1 ;
  BUTTONSIZE 60,30 ;
  FONT "Arial" ;
  SIZE 10 ;
  FLAT ;
  BORDER
  BUTTON bt_exit ;
   CAPTION 'e&Xit' ;
   ACTION p001win.Hide ;
   SEPARATOR
 END TOOLBAR

 DEFINE WINDOW Win_2 ;
  ROW 80 ;
  COL 30 ;
  WIDTH 300 ;
  HEIGHT 200 ;
  VIRTUALWIDTH 400 ;
  VIRTUALHEIGHT 400 ;
  WINDOWTYPE PANEL

  DEFINE LABEL lb_label1
   ROW 10
   COL 10
   VALUE 'Panel window...'
   WIDTH 300
  END LABEL
 END WINDOW

END WINDOW
p001win.Center
RETURN NIL

/************************************************************
* Sub (and panel) form open
************************************************************/
STATIC FUNCTION p000_OpenForm()
p001win.Show
p001win.Setfocus
RETURN NIL
Hope that helps :idea:

Re: PANEL - new window type

Posted: Wed Apr 28, 2010 9:13 am
by l3whmg
Hi Grigory,
many thanks! Work fine...with little trick :)

Best regards

Re: PANEL - new window type

Posted: Wed Apr 28, 2010 9:58 pm
by Roberto Lopez
l3whmg wrote:Hi friends,
I've tried to read about this new window type and it's use, but...
First of all I don't understand if I can use this new window type inside CHILD form.
After this, I've tried to use it but I receive an error during execution of my code.

I've included a sample prg and an error screenshot. I've defined/used form (with panel) one time as CHILD and one time as MODAL, but the error it's the same.

Many thanks in advantage
Using ACTIVATE WINDOW ALL command, NOAUTORELEASE style is assumed for all windows (excepting main).

Panel windows can't have the autorelease style, because their 'embedded' nature.

I'll reinforce error checking to warn the user about this.

Thanks for reporting.

Re: PANEL - new window type

Posted: Wed Apr 28, 2010 10:54 pm
by Roberto Lopez
Roberto Lopez wrote:
l3whmg wrote:Hi friends,
I've tried to read about this new window type and it's use, but...
First of all I don't understand if I can use this new window type inside CHILD form.
After this, I've tried to use it but I receive an error during execution of my code.

I've included a sample prg and an error screenshot. I've defined/used form (with panel) one time as CHILD and one time as MODAL, but the error it's the same.

Many thanks in advantage
Using ACTIVATE WINDOW ALL command, NOAUTORELEASE style is assumed for all windows (excepting main).

Panel windows can't have the autorelease style, because their 'embedded' nature.

I'll reinforce error checking to warn the user about this.

Thanks for reporting.
I've already fixed. Avoiding that Panel windows be double activated by ACTIVATE WINDOW ALL command.

I've found a problem with 'restore' method used by you (instead of 'show'). It not worked for non-visible windows.

Thanks again for reporting.

Re: PANEL - new window type

Posted: Fri Apr 30, 2010 7:24 am
by l3whmg
Hi Roberto,
many, many thanks to you forf your great job HMG!
Best regards