How to hide a tabpage ?

Moderator: Rathinagiri

Post Reply
JosK
Posts: 46
Joined: Tue Nov 08, 2011 11:38 pm

How to hide a tabpage ?

Post by JosK » Mon Dec 19, 2011 4:04 pm

wMain :=MaakMain("wMain")
oCW :=Widget():New("oCW",wMain)
oCW :CentralWidgetOF(wMain)
oLB :=LayoutBox():New("oLB",oCW,LAYOUT_TOPTOBOTTOM)
with object oTab:=Tab():New("oTab")
oTP1:=MaakTP1("oTP1",oTab)
oTP2:=MaakTP2("oTP2",oTab)
oTP3:=MaakTP3("oTP3",oTab)
end
OLB:add(oTab)
//oTab:hide() -> good, the tabblad is hide
oTP2:hide() -> doe's not work and

ON KEY F4 OF WMAIN ACTION {|| oTP2:hide() , oTp2:Refresh() } doe's not work
ON KEY F4 OF WMAIN ACTION {|| oTP2:hide() , msgstop("Test") oTab:Hide(), msgstop("Test"),oTab:Show()
The hide of oTab and the show on oTab works good with F4 (oTP2 doesn't hide)

(i have also tried it with oTab -> oTab.oTP2:hide() but does not work)

Any suggestions ?

JosK
Posts: 46
Joined: Tue Nov 08, 2011 11:38 pm

Post by JosK » Mon Dec 19, 2011 4:17 pm

oTp2:visible(.f.) has no result.

mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Post by mrduck » Mon Dec 19, 2011 5:28 pm

It seems it is not supported by Qt.

http://lists.trolltech.com/qt-interest/ ... 600-0.html

JosK
Posts: 46
Joined: Tue Nov 08, 2011 11:38 pm

Post by JosK » Mon Dec 19, 2011 11:07 pm

i can do oTP2:Enabled(.f.)

There is no (not yet a) methode for remove in hmg.4
Something like:

Code: Select all

void MainWindow::removeTab(int index)
{
    QString classname = ui->tabWidget->widget(index)->metaObject()->className();
    ui->tabWidget->removeTab(index);
    if (classname == "FormAccounts")
    {
       delete formAccounts;
        formAccounts = 0;
     }
   ui->listWidget->clearSelection();
   ui->listWidget->setCurrentRow(-1);
}

JosK
Posts: 46
Joined: Tue Nov 08, 2011 11:38 pm

Post by JosK » Mon Dec 19, 2011 11:14 pm

mrduck wrote:It seems it is not supported by Qt.

http://lists.trolltech.com/qt-interest/ ... 600-0.html
Thank you for the link.

JosK
Posts: 46
Joined: Tue Nov 08, 2011 11:38 pm

Post by JosK » Mon Dec 19, 2011 11:22 pm

i have changed svn\samples\demo_1.prg. This to test enabled(.f.)
(add three or four lines)

Code: Select all

#include "hmg.ch"
#include "hbqtgui.ch"

FUNCTION Main

   LOCAL oTab
   LOCAL oPage1
   LOCAL oPage2
   LOCAL oWindow

   HbQt_ErrorSys()

   WITH OBJECT oWindow := MAINWINDOW():New()
      :Row     := 10
      :Col     := 10
      :Width   := 400
      :Height  := 400
      :Title   := 'Nice OOP Demo!!!'
      :OnInit  := { || oWindow:Center() }

      WITH OBJECT MainMenu():New()

         WITH OBJECT MenuPopup():New( 'PopupPageTest',, 'Page Tests' )
            WITH OBJECT MenuItem():New( 'Item1',, 'SET oPage1 Caption' , { || oPage1:Caption := 'New'      } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item2',, 'SET oPage1 Image'   , { || oPage1:Image   := 'open.png' } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item3',, 'SET oPage1 Disable' , { || oPage1:Enabled := .F.        } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item4',, 'SET oPage1 Enable'  , { || oPage1:Enabled := .T.        } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item5',, 'SET oPage1 ToolTip' , { || oPage1:ToolTip := 'ToolTip'  } ) ; END WITH
         END WITH

         WITH OBJECT MenuPopup():New( 'PopupTabTest',, 'Tab Tests' )
            WITH OBJECT MenuItem():New( 'Item6' ,, 'SET Tabs Position (Top)'    , { || oTab:Position := TAB_TOP     } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item7' ,, 'SET Tabs Position (Bottom)' , { || oTab:Position := TAB_BOTTOM  } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item8' ,, 'SET Tabs Position (Left)'   , { || oTab:Position := TAB_LEFT    } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item9' ,, 'SET Tabs Position (Right)'  , { || oTab:Position := TAB_RIGHT   } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item10',, 'SET Tabs Shape (Triangular)', { || oTab:Shape := TAB_TRIANGULAR } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item11',, 'SET Tabs Shape (Rounded)'   , { || oTab:Shape := TAB_ROUNDED    } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item12',, 'SET Active Page TO 1'       , { || oTab:Value := 1              } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item13',, 'SET Active Page TO 2'       , { || oTab:Value := 2              } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item14',, 'SET OnChange Event'         , { || oTab:OnChange := { || MsgInfo( 'Changed' ) } } ) ; END WITH
            WITH OBJECT MenuItem():New( 'Item15',, 'Clear OnChange Event'       , { || oTab:OnChange := { || NIL }   } ) ; END WITH
         END WITH

      END WITH

      oWindow:QTObject:setObjectName( "oWindow" )

      WITH OBJECT oTab := Tab():New()
         :Row  := 30
         :Col  := 10
         :Width  := 300
         :Height  := 300
         :Position := 0

         WITH OBJECT oPage1 := TabPage():New()
            :Caption := 'One'

            WITH OBJECT Button():New()
               :Row     := 20
               :Col     := 20
               :Width   := 100
               :Caption := 'OOP Button!!!'
               :OnClick := { || MsgInfo( 'Test' ) }
            END WITH

         END WITH

         WITH OBJECT oPage2 :=TabPage():New()
            :Caption := 'Two'

            WITH OBJECT EditBox():New()
               :Row        := 20
               :Col        := 20
               :Width      := 100
               :Height     := 100
               :Value      := 'Hey!!!'
               :ScrollBars := EDB_NONE
               :ToolTip    := 'This is a ToolTip'
            END WITH

         END WITH

      END WITH

   END WITH

   ON KEY F4 OF oWindow ACTION {|| oPage2:Enabled(.f.) , msgstop("test") }

   oWindow:Activate()

   RETURN NIL

JosK
Posts: 46
Joined: Tue Nov 08, 2011 11:38 pm

Post by JosK » Tue Dec 20, 2011 12:50 am

Today there is, in QT, a TabRemoved(int index) and
http://qt.gitorious.org/qt/qt/blobs/4.7 ... .h#line161

Post Reply