Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11148

Re: ComCtl.ListViewCtrl doesn't show itself ....

From noone@no.void (Reventlov)
Newsgroups microsoft.public.scripting.vbscript
Subject Re: ComCtl.ListViewCtrl doesn't show itself ....
Date 2015-10-15 21:43 +0000
Organization Aioe.org NNTP Server
Message-ID <56201c19.5060312@nntp.aioe.org> (permalink)
References <56156a2f$0$23740$e4fe514c@news.xs4all.nl> <mv4671$j22$1@dont-email.me>

Show all headers | View raw


Il giorno Wed, 07 Oct 2015 18:28:30 -0400, GS <gs@v.invalid> ha scritto:
>Controls exist on forms only, either directly placed on a form OR 
>placed into a container control on a form. How to do.., I have no clue 
>in VBS!


You can create an HTA application, which is a html page with the extension changed to HTA.
It is a window that can contain text boxes, drop down menus, buttons, etc. And vbs code to
manage all of it.
I think there isn't a native html code for a listview and I don't know how to put the
object in the html code.

I've found this code in
http://www.tech-archive.net/Archive/Scripting/microsoft.public.scripting.vbscript/2005-12/msg00275.html
and here some theory
http://www.codeproject.com/Articles/33660/GUI-in-JScript-and-VBScript-using-Windows-Common-C

<html>
 <head>
  <hta:application id = "TestListView"
  />
  <title>TestListView</title>
  <meta http-equiv = "content-script-type" content = "text/vbscript"/>
  <script language = "VBScript"
          type     = "text/vbscript"
  >
'<![CDATA[

''= on load body: fill ListView
' ============================================================================ 

Sub onloadBody()
' MsgBox "onloadBody()"

  Dim oLV : Set oLV = document.getElementById( "lvListView" )
  If oLV Is Nothing Then
     MsgBox "oLV Is Nothing"
  Else
     Const cnRows = 30
     Const cnCols =  3
     Dim nRow, nCol, oLI

     With oLV
       .View   = 3
       .Width  = 300
       .Height = 400

       .ColumnHeaders.Clear
       For nCol = 1 To cnCols
         .ColumnHeaders.Add , , "Col " & nCol, 100
       Next

       .ListItems.Clear
       For nRow = 1 To cnRows
           Set oLI = .ListItems.Add
           oLI.Text = "R" & nRow & "C1"
           For nCol = 2 To cnCols
               oLI.ListSubItems.Add.Text = "R" & nRow & "C" & nCol
           Next
       Next
     End With
  End If
End Sub

''= refreshes the HTA page, which includes re-running any Windows_Onload code
' ============================================================================ 

Sub reloadHTA()
  location.reload( True )
End Sub

']]>
  </script>
 </head>

 <body onload = "onloadBody()">
  <form>
   <table border = "1">
    <tr>
     <td>
      <OBJECT id      = "lvListView"
              classid = "clsid:BDD1F04B-858B-11D1-B16A-00C0F0283628"
      >
      </OBJECT>
     </td>
    </tr>
   </table>
   <hr />
   <input type = "BUTTON" value = "reload" onclick = "reloadHTA()">
  </form>
 </body>
</html>

-- 
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
-- 

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

ComCtl.ListViewCtrl doesn't show itself .... "R.Wieser" <address@not.available> - 2015-10-07 20:56 +0200
  Re: ComCtl.ListViewCtrl doesn't show itself .... GS <gs@v.invalid> - 2015-10-07 18:28 -0400
    Re: ComCtl.ListViewCtrl doesn't show itself .... "R.Wieser" <address@not.available> - 2015-10-08 11:18 +0200
      Re: ComCtl.ListViewCtrl doesn't show itself .... "Mayayana" <mayayana@invalid.nospam> - 2015-10-15 19:31 -0400
        Re: ComCtl.ListViewCtrl doesn't show itself .... "R.Wieser" <address@not.available> - 2015-10-16 12:25 +0200
          Re: ComCtl.ListViewCtrl doesn't show itself .... "Mayayana" <mayayana@invalid.nospam> - 2015-10-16 10:21 -0400
            Re: ComCtl.ListViewCtrl doesn't show itself .... "R.Wieser" <address@not.available> - 2015-10-16 17:22 +0200
              Re: ComCtl.ListViewCtrl doesn't show itself .... "Mayayana" <mayayana@invalid.nospam> - 2015-10-16 12:09 -0400
                Re: ComCtl.ListViewCtrl doesn't show itself .... "R.Wieser" <address@not.available> - 2015-10-16 18:35 +0200
                Re: ComCtl.ListViewCtrl doesn't show itself .... "Mayayana" <mayayana@invalid.nospam> - 2015-10-16 12:49 -0400
                Re: ComCtl.ListViewCtrl doesn't show itself .... "R.Wieser" <address@not.available> - 2015-10-17 01:00 +0200
    Re: ComCtl.ListViewCtrl doesn't show itself .... noone@no.void (Reventlov) - 2015-10-15 21:43 +0000
    Re: ComCtl.ListViewCtrl doesn't show itself .... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-10-15 23:54 +0200

csiph-web