Page 1 of 2

search for TTabControl() Sample

PostPosted: Fri Oct 28, 2022 7:17 am
by Jimmy
hi,

i´m searching for TAB Sample and found TTabControl() and TTabs()
for TTabControl () i found
c:\fwh\samples\testtctr.prg

but Sample is limited to 10 lines ... :(

---

as i remember SysTabControl is "just" Control for "Tabs" but have "no Body"
in FiveWin Sample i can "see" a white Area so i guess "something" have add

but how to "use Body" as Parent to put a Control on it :?:

---

i try to use oTabs as Parent but got Error
Called from: ../../../tobject.prg => TTABCONTROL:ADIALOGS( 0 )
Called from: .\source\classes\WINDOW.PRG => (b)TWINDOW_GOTFOCUS( 3018 )

but there is not ADIALOGS in CLASS TTabControl() ... hm :?

who can help me and show me a (working) Sample

.p.s. i do not want to use CLASS TTabs()

Re: search for TTabControl() Sample

PostPosted: Fri Oct 28, 2022 12:11 pm
by Jimmy
here a Sample which crash TTABCONTROL:ADIALOGS
Code: Select all  Expand view
#include "FiveWin.ch"
MEMVAR oMain, oExplorer, oStatusBar, lImage, oTabs

PROCEDURE Main()
LOCAL oFont
LOCAL nHeight   := 1024
LOCAL nWidth    := 1280
LOCAL nTop      := 0
LOCAL nLeft     := 0
LOCAL nIcoLarge := 256
LOCAL nIcoSmall := 32
LOCAL cLog      := cFileSetExt( ExeName(), "LOG" )

PRIVATE oMain
PRIVATE oExplorer
PRIVATE oStatusBar
PRIVATE oTabs

   DEFINE WINDOW oMain FROM  0,0 TO nWidth, nHeight PIXEL TITLE "FiveWin TGrid Listview Demo " ICON "A1MAIN"

      oTabs = TTabControl():New( nTop, nLeft, , , oMain, , , , .T., .F., nWidth-20, nHeight-20, )
      oTabs:bAction = {|| EVAL(&("DoProc"+AllTrim( Str( oTabs:nOption ) )+"()" )) }

      oTabs:Add( "Grid_1 " )
      oTabs:Add( "Grid_2 " )
      oTabs:Add( "Grid_3 " )

      DEFINE STATUSBAR oStatusBar PROMPT "Hello World " OF oMain SIZES nWidth - 100 CLOCK

#IFDEF __HMG__
      END STATUSBAR
   END WINDOW
#ENDIF

  ACTIVATE WINDOW oMain CENTER

RETURN

PROCEDURE DoProc1()
   MsgInfo("switch 1")
RETURN

PROCEDURE DoProc2()
   MsgInfo("switch 2")
RETURN

PROCEDURE DoProc3()
   MsgInfo("switch 3")
RETURN

it does show MsgInfo() and than crash :(

Error description: Error BASE/1004 Message not found: TTABCONTROL:ADIALOGS
Args:
[ 1] = O TTABCONTROL

Stack Calls
===========
Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TTABCONTROL:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TTABCONTROL:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TTABCONTROL:ADIALOGS( 0 )
Called from: .\source\classes\WINDOW.PRG => (b)TWINDOW_GOTFOCUS( 3018 )
Called from: => AEVAL( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:GOTFOCUS( 3018 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3681 )
Called from: => MSGINFO( 0 )
Called from: TCONTROL.prg => DOPROC2( 60 )
Called from: TCONTROL.prg => (b)MAIN( 23 )
Called from: .\source\classes\TTABCTRL.PRG => TTABCONTROL:NOTIFY( 165 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:NOTIFY( 1612 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3681 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1114 )
Called from: TCONTROL.prg => MAIN( 51 )

Re: search for TTabControl() Sample

PostPosted: Fri Oct 28, 2022 7:53 pm
by Antonio Linares
Dear Jimmy,

I guess that you are talking about folders. In FWH you have the class TFolder

Search for TFolder in FWH\samples

Re: search for TTabControl() Sample

PostPosted: Fri Oct 28, 2022 11:46 pm
by Jimmy
hi Antonio,
Antonio Linares wrote:I guess that you are talking about folders. In FWH you have the class TFolder

thx for Hint using CLASS TFolder()

i have look into Sample Textfx3.PRG but don´t understand how it work.
i can "see" some Controls on "Body" but where is the CODE for it :?

---

Sample Textfx4.PRG "seems" to show what i miss "aDialogs"
Code: Select all  Expand view
 oFld:aDialogs[ 2 ]

so i will try that

---

Question : what is TTABCONTROL() for when not used under FiveWin :?:

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 5:59 am
by Jimmy
hi Antonio,

have some (small) Problem with TFolder()

when i assign {} as 3rd Parameter (aPrompts) of TFolder() and use AddItem() than Control will not appear :?

Code: Select all  Expand view
  oTabs := TFolder():New( 0, 0,{} , , oMain, 1, , , .t.,;
                          .f., oMain:nRight - oMain:nLeft, oMain:nBottom - oMain:nTop )
   oTabs:AddItem("Grid_1")

   @ 20, 10 BUTTON oBtn PROMPT "blabla" SIZE 300,200 OF oTabs:aDialogs[ 1 ] PIXEL ACTION MsgInfo("blabla")

...

when add more Tab
Code: Select all  Expand view
  oTabs:AddItem("Grid_2")

Button on oTabs:aDialogs[ 1 ] appear

---

when "fill" 3rd Parameter {"Test"} and NOT use AddItem() it work and Button appear

is this a BUG :?:

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 7:30 am
by Antonio Linares
Dear Jimmy,

Please provide a complete PRG to test it, thanks

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 7:47 am
by Jimmy
try this
Code: Select all  Expand view
#include "FiveWin.ch"
MEMVAR oMain, oTabs, oStatusBar

PROCEDURE Main()
LOCAL oFont
LOCAL nHeight   := 1024
LOCAL nWidth    := 1280
LOCAL nTop      := 0
LOCAL nLeft     := 0
LOCAL oBtn

PRIVATE oMain, oTabs, oStatusBar

   DEFINE WINDOW oMain FROM  0,0 TO nWidth, nHeight PIXEL TITLE "FiveWin TGrid Listview Demo "

* #define working
#IFDEF working
   oTabs := TFolder():New( 3, 3,{"no_1"} , , oMain, 1, , , .t.,;
                          .f., oMain:nRight - oMain:nLeft, oMain:nBottom - oMain:nTop )
#ELSE
   oTabs := TFolder():New( 3, 3,{} , , oMain, 1, , , .t.,;
                          .f., oMain:nRight - oMain:nLeft, oMain:nBottom - oMain:nTop )
   oTabs:AddItem("Grid_1")
*  oTabs:AddItem("Grid_2")
#ENDIF

   oTabs:SetOption( 1 )

   @ 20, 10 BUTTON oBtn PROMPT "blabla" SIZE 300,200 OF oTabs:aDialogs[ 1 ] PIXEL ACTION MsgInfo("blabla")

      DEFINE STATUSBAR oStatusBar PROMPT "Hello World " OF oMain SIZES nWidth - 100 CLOCK

   ACTIVATE WINDOW oMain CENTER

RETURN

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 8:31 am
by Enrico Maria Giordano
This works fine here:

Code: Select all  Expand view
#include "FiveWin.ch"

PROCEDURE Main()
LOCAL nHeight   := 1024
LOCAL nWidth    := 1280

PRIVATE oMain, oTabs, oStatusBar

   DEFINE WINDOW oMain FROM  0,0 TO nWidth, nHeight PIXEL TITLE "FiveWin TGrid Listview Demo "

* #define working
#ifdef working
   oTabs := TFolder():New( 3, 3,{"no_1"} , , oMain, 1, , , .t.,;
                          .f., oMain:nRight - oMain:nLeft, oMain:nBottom - oMain:nTop )
#else
   oTabs := TFolder():New( 3, 3,{} , , oMain, 1, , , .t.,;
                          .f., oMain:nRight - oMain:nLeft, oMain:nBottom - oMain:nTop )
   oTabs:AddItem("Grid_1")
   oTabs:AddItem("Grid_2")
#endif

   oTabs:SetOption( 1 )

   @ 20, 10 BUTTON "blabla" SIZE 300,200 OF oTabs:aDialogs[ 1 ] PIXEL ACTION MsgInfo("blabla")
   @ 20, 10 BUTTON "blabla2" SIZE 300,200 OF oTabs:aDialogs[ 2 ] PIXEL ACTION MsgInfo("blabla2")

      DEFINE STATUSBAR oStatusBar PROMPT "Hello World " OF oMain SIZES nWidth - 100 CLOCK

   ACTIVATE WINDOW oMain CENTER

RETURN

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 8:46 am
by Jimmy
hi Enrico,
Enrico Maria Giordano wrote:This works fine here:

did you see a big Button and got MsgInfo() when click on it :?:

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 8:51 am
by Enrico Maria Giordano
Yes, on both tabs.

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 10:00 am
by Jimmy
hi Enrico,
Enrico Maria Giordano wrote:Yes, on both tabs.

should be only 1 x TAB , as provide Original, which does not work

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 10:29 am
by Enrico Maria Giordano
I don't understand. Can you describe the problem clearly and show a sample reproducing it, please?

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 10:29 am
by Antonio Linares
Dear Jimmy,

This is the right way to do it:
Code: Select all  Expand view
#include "FiveWin.ch"
MEMVAR oMain, oTabs, oStatusBar

PROCEDURE Main()
LOCAL oFont
LOCAL nHeight   := 400
LOCAL nWidth    := 300
LOCAL nTop      := 0
LOCAL nLeft     := 0
LOCAL oBtn

PRIVATE oMain, oTabs, oStatusBar

   DEFINE WINDOW oMain FROM 0, 0 TO nWidth, nHeight PIXEL TITLE "FiveWin TGrid Listview Demo "

   @ 0, 0 FOLDER oTabs PROMPTS "no_1" OF oMain

   oMain:oClient = oTabs

   @ 20, 10 BUTTON oBtn PROMPT "blabla" SIZE 80, 20 OF oTabs:aDialogs[ 1 ] PIXEL ACTION MsgInfo( "blabla" )

   DEFINE STATUSBAR oStatusBar PROMPT "Hello World " OF oMain SIZES nWidth - 100 CLOCK

   ACTIVATE WINDOW oMain CENTER

RETURN

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 4:13 pm
by Marc Venken
Jimmy,

This post has also a sample with Folders. Maybe usefull

viewtopic.php?f=3&t=41175&hilit=+folder

Re: search for TTabControl() Sample

PostPosted: Sat Oct 29, 2022 5:25 pm
by nageswaragunupudi
FWH class TFolder and TPages are created from Windows TTabControl32, with extended functionality.

TFolder class is very widely used and we should find many examples if we look around.

TFolderEx is totally FWH own control and does not depend on any Windows control.

TTabs control also is an FWH own control.