Seite 1 von 1

:hide() / :show() activeX ? [erledigt]

Verfasst: So, 29. Aug 2010 16:08
von AUGE_OHR
hi,
------------------------------------------------------------------------------
FEHLERPROTOKOLL von "D:\ALASKA\SPLIT\1\BUGDEMO.EXE" Datum: 29.08.10 16:05:13

Xbase++ Version : Xbase++ (R) Version 1.90.355
Betriebssystem : Windows XP 05.01 Build 02600 Service Pack 3
------------------------------------------------------------------------------
oError:args :
oError:canDefault : J
oError:canRetry : N
oError:canSubstitute: J
oError:cargo : NIL
oError:description : Component is no ActiveX control
oError:filename : NIL
oError:genCode : 6502
oError:operation : XBPACTIVEXCONTROL:CREATEHANDLE
oError:osCode : NIL
oError:severity : 2
oError:subCode : 6500
oError:subSystem : Automation
oError:thread : 2
oError:tries : NIL
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
(EVM Ereignis-Dispatcher)
und hier der Code

Code: Alles auswählen

#include "Xbp.ch"
#include "Appevent.ch"
#include "GRA.ch"

#PRAGMA LIBRARY( "ASCOM10.LIB" )

PROCEDURE AppSys()
RETURN

PROCEDURE Main
LOCAL nEvent, mp1, mp2
LOCAL oApp, oXbp, drawingArea
LOCAL oStat
LOCAL oView
LOCAL lOnOff := .T.

   oApp := XbpDialog():New(AppDeskTop(), , {0,0}, {600,400}, , .F.)
   oApp:taskList     := .T.
   oApp:title        := "Demo"
*   oApp:ClipChildren := .T.
*   oApp:DrawingArea:ClipChildren := .T.
   oApp:create()

   drawingArea := oApp:drawingArea
   drawingArea:setFontCompoundName( "10.Arial" )
   drawingArea:setcolorBG(GRA_CLR_WHITE)

   oStat := XbpStatic():New( drawingArea,,{0,0},drawingArea:currentsize()  )
   oStat:Caption := "bitte warten ..."
   oStat:options := XBPSTATIC_TEXT_CENTER+XBPSTATIC_TEXT_VCENTER
   oStat:create()
   oStat:setFontCompoundName( "24.Arial" )
   oStat:setcolorFG(GRA_CLR_RED)
   oStat:setcolorBG(GRA_CLR_WHITE)

   oView := XbpListView():new( oStat,,{0,0},oStat:currentsize() )
   oView:create()
   oView:setFontCompoundName( "10.Arial" )
   oView:setcolorFG(GRA_CLR_BLACK)
   oView:setcolorBG(GRA_CLR_WHITE)
   oView:view := 3       // lvwReport

   AddHeaders(oView)

   oApp:show()
   oView:show()

   //
   // wait to "see" that all is ok
   //
   SLEEP(100*3)

   nEvent := xbe_None
   DO WHILE nEvent <> xbeP_Close
      nEvent := AppEvent( @mp1, @mp2, @oXbp,100 )
      DO CASE
         CASE nEvent = xbe_None
            IF lOnOff == .T.
               lOnOff := .F.
               oView:hide()
            ELSE
               lOnOff := .T.
               msgbox("now Error activeX ?!")
               oView:show()
            ENDIF
      OTHERWISE
         oXbp:handleEvent( nEvent, mp1, mp2 )
      ENDCASE
   ENDDO
RETURN


#define lvwColumnLeft   0
#define lvwColumnRight  1

Procedure AddHeaders(oView)
/********************************************************************

Index       An integer that uniquely identifies a member of an object collection.
Key         A unique string expression that can be used to access a member of the collection.
Text        The text to display in the column header.
Width       The initial width of the column header.
Alignment   An integer that determines the alignment of text in the column header.
Icon        The index value of the image to display in the column header.

********************************************************************/
LOCAL oHeader
   oHeader := oView:ColumnHeaders:Add(,,'Name',150,lvwColumnLeft ,)  
   oHeader := oView:ColumnHeaders:Add(,,'Size',100,lvwColumnRight,)  
   oHeader := oView:ColumnHeaders:Add(,,'Date', 56,lvwColumnLeft ,)  
   oHeader := oView:ColumnHeaders:Add(,,'Time', 56,lvwColumnLeft ,)  
   oHeader := oView:ColumnHeaders:Add(,,'A'   , 20,lvwColumnLeft ,)  
RETURN

CLASS XbpListView FROM XbpActiveXControl
   EXPORTED:
      METHOD init
      METHOD create

ENDCLASS

METHOD XbpListView:init( oParent, oOwner, aPos, aSize, aPP, lVisible )

   ::XbpActiveXControl:Init( oParent, oOwner, aPos, aSize, aPP, lVisible )

*  ::CLSID   := "{BDD1F04B-858B-11D1-B16A-00C0F0283628}"
   ::CLSID   := "MSComctlLib.ListViewCtrl.2"
   ::License := "9368265E-85FE-11d1-8BE3-0000F8754DA1"

   ::TabStop := .T.
RETURN self

METHOD XbpListView:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
   ::XbpActiveXControl:Create(oParent,oOwner,aPos,aSize,aPP,lVisible )
RETURN self

*
* eof
*
wieso geht das :show() nicht mehr nach dem :hide() :?:

Re: :hide() / :show() activeX ?

Verfasst: So, 29. Aug 2010 17:42
von Rolf Ramacher
Hi Jimmy

wenn ich das richtig verstehe heißt doch :hide() - verstecken - also nicht sichtbar

Re: :hide() / :show() activeX ?

Verfasst: So, 29. Aug 2010 18:07
von Wolfgang Ciriack
Ja Rolf,
und show heisst anzeigen - also nicht verstecken.

Re: :hide() / :show() activeX ?

Verfasst: So, 29. Aug 2010 22:55
von AUGE_OHR
hi,

Frage : bekommt ihr auch, nach der Msgbox(), die Fehlermeldung ?

Der Grund warum ich erst :hide() verwenden möchte :
mit Bildschirm Ausgabe "dauert" es viel länger ...

Interessanterweise gibt es bei XbpActivexControl() auch kein :hide() ... aber :show()

Re: :hide() / :show() activeX ?

Verfasst: So, 29. Aug 2010 23:48
von brandelh
Hi,

heißt das bei Word und Excel nicht :visible := ?

Re: :hide() / :show() activeX ?

Verfasst: Mo, 30. Aug 2010 2:17
von AUGE_OHR
brandelh hat geschrieben:heißt das bei Word und Excel nicht :visible := ?
gute Idee ... aber leider finde ich in MsComCtl.OCX nichts was mit dem ListView zusammen hängt .... Panel, Node (TreeView), Button und ButtonMenu haben :visible

ich begreife die "Fehlermeldung" einfach nicht ... was will er den "da" machen ?
... es sieht so aus als wenn er, durch das :hide(), die "Verbindung verloren" hat ?

Re: :hide() / :show() activeX ?

Verfasst: Mo, 30. Aug 2010 2:17
von AUGE_OHR
ok, ich habe mir nun einem Workaround einfallen lassen :

Code: Alles auswählen

::ListView:setSize({0,0})
::ListView:AddAllItem(aDir)
::ListView:setSize(::currentSize())
* ::ListView:Refresh()

Re: :hide() / :show() activeX ?

Verfasst: Mo, 30. Aug 2010 23:03
von AUGE_OHR
hi,

Code: Alles auswählen

oView:UserEvents     := .t.
oView:UseGuiThread   := .f.
oView:ReCreateHandle := .f.
ist die Lösung, gefunden von Andreas Gehrs-Pahl
public.xbase++.bugreport, Re: :hide() / :show() Error with activeX ?, 30. August 2010

I have struggled with this, too. The solution is to use the undocumented
iVar "ReCreateHandle" before creating the Active-X object. I would also
explicitly set "UserEvents" and "UseGuiThread". So, with those three
instance variables set in your code before oView:Create(), the program
will works as expected.

oView := XbpListView():New(oStat, , {0, 0}, oStat:CurrentSize(), , .f.)
oView:UserEvents := .t.
oView:UseGuiThread := .f.
oView:ReCreateHandle := .f.
oView:Create()