I am having an issue with hmg, and i am not sure if it's a feature, a bug, or wrong coding. I have a complex form with around 200 fields. It is divided in sections and each section is represented by a tab. Now, some of the sections can't be placed in a single screen (the tab container) so i tried to implement a panel window inside a tab (not on EVERY tab) just tab N.
I've found here in the forum a bit of code that implements a panel window so i played with it . Code is below:
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 TAB Tab_1 AT 60 , 180 WIDTH 800 HEIGHT 520 VALUE 1 TOOLTIP "" FLAT ON CHANGE Nil
PAGE "P1"
END PAGE
PAGE "P2"
END PAGE
PAGE "P3"
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 PAGE
END TAB
END WINDOW
p001win.Center
RETURN NIL
/************************************************************
* Sub (and panel) form open
************************************************************/
STATIC FUNCTION p000_OpenForm()
p001win.Show
p001win.Setfocus
RETURN NIL
When i run the program i can see the panel is displayed on 1st tab of Tab_1 (i could think that is ok as it's loaded with parent window but then i expect it to be present on all tabs) . It is not. Just in tab 1. So i click on P3 and there's my panel with the label inside. But then i go back to P1 and my window panel isn't there. Si it looks like it is displayed only the first time, then it's gone.
If you compile the snippet you will see the issue i am experiencing
My main goal is to make the window Win_2 to be displayed ONLY in P3 , and my doubt is about the weird behaviour when form is loaded.
I am running 3.0.39 (Test 2011-09-12) (download from this forum)
Any help will be appreciated.
Thanks,
Pablo