2012-09-23 11:32 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/tests/activex.hbp
* contrib/hbqt/tests/activex.prg
* contrib/hbqt/tests/activex.ui
+ Added: a demonstration applying HbQt's controvertial
QWidget():winID() call to be used with Harbour's native
ActiveX engine. The demo is less than 70 lines of code
and blends Qt Creator, HbQt, hbWIN in a meaningful way.
This commit is contained in:
@@ -16,6 +16,15 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-09-23 11:32 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/tests/activex.hbp
|
||||
* contrib/hbqt/tests/activex.prg
|
||||
* contrib/hbqt/tests/activex.ui
|
||||
+ Added: a demonstration applying HbQt's controvertial
|
||||
QWidget():winID() call to be used with Harbour's native
|
||||
ActiveX engine. The demo is less than 70 lines of code
|
||||
and blends Qt Creator, HbQt, hbWIN in a meaningful way.
|
||||
|
||||
2012-09-22 08:58 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/main.prg
|
||||
! Fixed: regression - IdeDBU was not showing up auto when
|
||||
|
||||
20
harbour/contrib/hbqt/tests/activex.hbp
Normal file
20
harbour/contrib/hbqt/tests/activex.hbp
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
-3rd=hbide_version=1.0
|
||||
-3rd=hbide_title=ActiveX
|
||||
-3rd=hbide_output=activex
|
||||
|
||||
-inc
|
||||
-w3
|
||||
-es2
|
||||
|
||||
hbqt.hbc
|
||||
gtwvg.hbc
|
||||
|
||||
activex.prg
|
||||
|
||||
activex.ui
|
||||
|
||||
|
||||
102
harbour/contrib/hbqt/tests/activex.prg
Normal file
102
harbour/contrib/hbqt/tests/activex.prg
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* W A R N I N G : Windows Only Code
|
||||
*
|
||||
* Demonstrate the usage of Windows ActiveX functionality
|
||||
* available in HbQt via QWidget():winID() call. This demonstration
|
||||
* is one of the many benefits :winID() facilitates without breaking
|
||||
* compatilibility. The programmer ( me, here ) knows what he/she is
|
||||
* doing. On the contrary, I am free TO do mathematical operations
|
||||
* with :winID(), like, IF o:winID() > 99999999 ; WOW() ; ELSE sigh()
|
||||
*
|
||||
* To build I am inclusing GtWVG as it already has class to construct activex window.
|
||||
* This is just to cut the time short. Anyway we will be using activeX on windows only
|
||||
*
|
||||
* This can be argued that if this all can be done in pure Windows, then why through HbQt ?
|
||||
*
|
||||
* The answer is simple: Harbour's WINAPI related infrastructure is so inadequate that it is
|
||||
* extremely difficult IF not impossible. There are two reasons: 1. Harbour does not have
|
||||
* any upper level GUI library, 2. Structure support in Harbour, as of current, is broken.
|
||||
* So the effective GUI library is HbQt, complete with all GUI stuff, which can be exploited
|
||||
* to harness the power of Windows exclusive functionality via winID() call.
|
||||
*
|
||||
* This less than 70 lines of code demonstrate what can be achieved with WINAPI in hundreds...
|
||||
*
|
||||
* Pritpal Bedi 23Sep2012
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbqtgui.ch"
|
||||
#include "hbtrace.ch"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
FUNCTION Main()
|
||||
LOCAL oUI, oActiveX
|
||||
|
||||
hbqt_errorsys()
|
||||
|
||||
oUI := hbqtui_activex()
|
||||
|
||||
oActiveX := BuildActiveX( oUI )
|
||||
|
||||
oUI:connect( QEvent_Resize, {|| oActiveX:setSize( { oUI:frameActiveX:width(), oUI:frameActiveX:height() } ) } )
|
||||
oUI:editNavigate:setText( "http://hbide.vouch.info" )
|
||||
oUI:btnNavigate:connect( "clicked()", {|| HandleNavigation( oUI, oActiveX ) } )
|
||||
oUI:btnRefresh:connect( "clicked()" , {|| oActiveX:refresh() } )
|
||||
|
||||
oUI:treeUrls:setHeaderHidden( .T. )
|
||||
oUI:treeUrls:setTooltip( "Click on any url to navigate !" )
|
||||
oUI:treeUrls:connect( "itemPressed(QTreeWidgetItem*,int)", {|q,i| oActiveX:navigate( q:text( i ) ) } )
|
||||
|
||||
oUI:splitterOne:connect( "splitterMoved(int,int)", {|| oActiveX:setSize( { oUI:frameActiveX:width(), oUI:frameActiveX:height() } ) } )
|
||||
|
||||
oUI:editNavigate:connect( "returnPressed()", {|| oUI:btnNavigate:click() } )
|
||||
oUI:editNavigate:setFocus()
|
||||
|
||||
oUI:show()
|
||||
|
||||
oUI:btnNavigate:click()
|
||||
oUI:resize( 1000, 500 )
|
||||
oUI:treeUrls:setFocus()
|
||||
|
||||
QApplication():exec()
|
||||
|
||||
RETURN oActiveX
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
FUNCTION BuildActiveX( oUI )
|
||||
LOCAL oXbp, oActiveX
|
||||
|
||||
oXbp := WvgWindow():new( , , { 0, 0 }, { 640, 400 }, , .T. )
|
||||
oXbp:hWnd := oUI:frameActiveX:winID()
|
||||
|
||||
oActiveX := WvgActiveXControl():new( oXbp, , { 0, 0 }, { 100, 100 }, , .t. )
|
||||
|
||||
oActiveX:CLSID := "Shell.Explorer.2"
|
||||
oActiveX:mapEvent( 269, {|| oUI:labelStatus:setText( ' E X P L O R E R - 2 6 9' ) } )
|
||||
oActiveX:mapEvent( 105, {|| oUI:labelStatus:setText( ' E X P L O R E R - 105' ) } )
|
||||
|
||||
oActiveX:create()
|
||||
|
||||
RETURN oActiveX
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
FUNCTION HandleNavigation( oUI, oActiveX )
|
||||
LOCAL qItm := QTreeWidgetItem()
|
||||
|
||||
oActiveX:navigate( oUI:editNavigate:text() )
|
||||
|
||||
qItm:setText( 0, oUI:editNavigate:text() )
|
||||
|
||||
oUI:treeUrls:addTopLevelItem( qItm )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
159
harbour/contrib/hbqt/tests/activex.ui
Normal file
159
harbour/contrib/hbqt/tests/activex.ui
Normal file
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FormActiveX</class>
|
||||
<widget class="QWidget" name="FormActiveX">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>607</width>
|
||||
<height>569</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ActiveX</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>53</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Navigate </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editNavigate">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnNavigate">
|
||||
<property name="text">
|
||||
<string>Navigate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRefresh">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="labelStatus">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitterOne">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTreeWidget" name="treeUrls">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frameActiveX">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user