guitk updated

Windows specific questions.
Post Reply
aloberoger
Posts: 507
Joined: Jan 13, 2009 19:23

guitk updated

Post by aloberoger »

this is an update version of guitk i have already posted some times ago.
http://www.2shared.com/file/_4H6R-kQ/guitkpost2.html
suggestions are wellcome
aloberoger
Posts: 507
Joined: Jan 13, 2009 19:23

Re: guitk updated

Post by aloberoger »

Here Is the source code for GUI look in the folder guitk Nouveau .../ GUI
The others files and folder are the test examples

http://www.2shared.com/file/SA-_AK6f/gu ... 92013.html
aloberoger
Posts: 507
Joined: Jan 13, 2009 19:23

Re: guitk updated

Post by aloberoger »

Propertybox.bas

Code: Select all

#Include Once "gui/gui.bi"
 
DIM Shared curSel         AS INTEGER
DIM Shared prevSel        AS INTEGER
DIM Shared nDivider       AS INTEGER
DIM Shared nDivTop        AS INTEGER
DIM Shared nDivBtm        AS INTEGER
DIM Shared nOldDivX       AS INTEGER
DIM Shared nLastBox       AS INTEGER
DIM Shared bTracking      AS LONG
DIM Shared bDivIsSet      AS INTEGER
  
DIM Shared hCursorArrow   AS HCURSOR
Dim Shared hCursorSize    AS HCURSOR
Dim Shared cColor()       AS LONG
  
 Dim Shared pt AS Point



TYPE PROPERTYITEM
  propName  AS ZSTRING*225
  curValue  AS ZString*255
  nItemType AS INTEGER
  cmbItems  AS ZString*255
END TYPE
  
DIM Shared pItem()  AS PROPERTYITEM 'details for User designed custom control
  
'PIT = property item type, Button is default
Const PIT_COMBO   = 0
Const PIT_EDIT    = 1
Const PIT_COLOR   = 2
Const PIT_FONT    = 3
Const PIT_FILE    = 4


DIM Shared ghUCC    AS HWND
Dim Shared As HWND ghmyButton

DECLARE SUB InitializePropertyItems()

 
Declare SUB InvertLine( ByVal xleft1 AS INTEGER ,ByVal yFrom AS INTEGER ,ByVal xleft2 AS INTEGER ,ByVal yTo AS INTEGER)
 Declare Sub OnChange()



function TALLY(byref source as string,byref delimiter as string)as long
	Dim As Long i,s,c,l
	s=1
	l=Len(delimiter)
	do
		i=instr(s,source,delimiter)
		If i>0 then
			c+=1
			s=i+l
		end if 
	loop until i=0
	function=c
end Function

FUNCTION  PARSE (source as String, delimiter as String=",", index as Integer) As String
	Dim As Long i,s,c,l
	s=1
	l=Len(delimiter)
	do
		If c=index-1 then
			function=mid(source,s,instr(s,source,delimiter)-s)
			exit function
		end if
		i=instr(s,source,delimiter)
		If i>0 then
			c+=1
			s=i+l
		end if 
	loop until i=0
End Function



 type TFORM1 extends TFORM
   Private: 
   Public: 
      ListBox1	 AS 	TListBox
      BUTTON1	 AS 	TButton
      combo     As   TComboBox
      Edit      As   TEDIT
      Button    As TButton
      openDialog1 As TOpenDialog
      Colordlg1   As TColorDialog
      FontDialog1 As TFontDialog 
 Declare Static SUB ListBox1_Change(ByRef sender As TLISTBOX)
 DECLARE Static SUB ListBox1_DBClick(ByRef sender As TLISTBOX)
 DECLARE Static SUB ListBox1_MeasureItem(ByRef sender As TLISTBOX,ItemIndex As Integer,BYREF Height As Integer)
 DECLARE Static SUB ListBox1_DrawItem (ByRef sender As TLISTBOX,ItemIndex As Integer,State As Integer,BYREF R As Rect,DC As HDC = 0)
 DECLARE Static SUB ListBox1_MouseDown (ByRef sender As TLISTBOX,MouseButton As Integer,x As Integer,y As Integer,Shift As Integer)
 DECLARE Static SUB ListBox1_MouseMove (ByRef sender As TLISTBOX,x As Integer,y As Integer,Shift As Integer)
 DECLARE Static SUB ListBox1_MouseUp (ByRef sender As TLISTBOX,MouseButton As Integer,x As Integer,y As Integer,Shift As Integer)
 DECLARE Static SUB ListBox1_CaptureChanged(ByRef sender As TLISTBOX,hwnd As HWND)
 Declare Static SUB BUTTON1_Click(ByRef sender As TBUTTON)
 
 DECLARE Static SUB Button_Click(ByRef sender As TBUTTON)
 DECLARE Static SUB combo_Click(ByRef sender As TCOMBOBOX)
 DECLARE Static SUB Edit_Click(ByRef sender As TEDIT)
 
	Declare Static Sub FormCreate(ByRef sender As TFORM)
	Declare Static Sub FormShow(ByRef sender As TFORM)
	Declare Static Sub FormDestroy(ByRef sender As TFORM)
	Declare Static Sub FormResize(ByRef sender As TFORM)
	DECLARE   SUB FormLoad()
	Declare constructor
	Declare Destructor
 End type 
 
 
DIM SHARED  Form1	 AS TFORM1

'***************************************************************
' Now let's create and load the form and all of its controls
'***************************************************************

SUB TFORM1.FormLoad()
 WITH  Form1
   .MainForm    = 1 ' Change this to 0 if not the main Form
   .Create    
   .Caption     =  "Form1"
   .Left        =  115
   .Top         =  180
   .Width       =  440
   .Height      =  512
   
   .OnCreate     = @FormCreate
   .OnShow       = @FormShow
   .OnDestroy    = @FormDestroy

   
 	WITH  ListBox1
   		.Text     =  ""
   		.Parent     =  cast(TFORM,Form1)
   		.Left        =  8
   		.Top         =  16
   		.Width       =  252
   		.Height      =  256
   		.Visible      = TRUE
   		'.Color      = BGR(255,0,128)
   		.onChange = @ListBox1_Change
   		.onMeasureItem = @ListBox1_MeasureItem
   		.onDrawItem = @ListBox1_DrawItem
   		.OnMouseDown=@ListBox1_MouseDown
         .OnMouseMove=@ListBox1_MouseMove
         .OnMouseUp=@ListBox1_MouseUp 
   		.OnCaptureChanged= @ListBox1_CaptureChanged 
   		
   		.style= lbOwnerDrawFIXED
 	END With
 	
 			WITH  BUTTON1
   			.Caption     =  "&Button"
   			.Parent    =  cast(TFORM,Form1)
   			.Left        =  270
   			.Top         =  400
   			.Width       =  124
   			.Height      =  56
   			.OnClick      = @BUTTON1_Click
   			.Visible      = TRUE
   		    .Color      = BGR(255,0,128)
 			END With
 			
 			
 			  With  combo
   			.Parent    =  Listbox1 
   			.Left        =  0
   			.Top         =  0
   			.Width       =  10
   			.Height      =  100
   		 	.OnChange      = @combo_Click
   			.Visible      = FALSE
   		 
 			END With
             
         With  Edit
   			 
   			.Parent    =  Listbox1 
   			.Left      =  0
   			.Top       =  0
   			.Width     =  10
   			.Height    =  20
   		 	.OnChange  = @Edit_Click
   			.Visible   = FALSE
   		   Qcontrol(Edit).ExStyle=WS_EX_WINDOWEDGE   
 			END With
 			
 			WITH  button
   			.Caption     =  "..."
   			.Parent    =  Listbox1
   			.Left        =  0
   			.Top         =  0
   			.Width       =  8
   			.Height      =  12
   			.OnClick      = @BUTTON_Click
   			.Visible      = FALSE
   		 
 			END With
 			
   .Visible      =1  '2 is Maximized 
  .Show  ' Affiche la Form
 END WITH
END SUB


'***********************************************************************************
' Add any other supporting routines here
'***********************************************************************************
Sub TFORM1.FormCreate(ByRef sender As TFORM)
          ReDim pItem(0 To 16) AS PROPERTYITEM
 
            bTracking =  FALSE
            nDivider  = 0
            bDivIsSet =  FALSE
            curSel    = 1
  
             hCursorArrow =  LoadCursor(NULL, ByVal  IDC_ARROW )
             hCursorSize  =  LoadCursor(NULL, ByVal  IDC_SIZEWE )
            
           '  This   must be done AFTER the listbox has been created!
              InitializePropertyItems()
            
  
            
End Sub


 

Sub TFORM1.FormShow(ByRef sender As TFORM)
                ' Add Your Code hear
End Sub

  

Sub TFORM1.FormDestroy(ByRef sender As TFORM)
                ' Add Your Code hear
End Sub

 

Constructor TFORM1
              ' Add Your Code hear
 End Constructor

Destructor TFORM1
  '                    Add Your Code hear
End Destructor

  SUB  TFORM1.ListBox1_Change(ByRef sender As TLISTBOX) 
  
    Dim rc AS RECT
    Dim lBoxSelText AS STRING
  
    curSel = Form1.Listbox1.selectedIndex  ' you need Form1. because this sub Is declare Static
      SendMessage( Form1.Listbox1.Handle,  LB_GETITEMRECT, curSel, Cast(LPARAM,@rc)) 
  
    rc.left = nDivider
   
    IF Form1.Combo.Handle  <> 0 THEN    Form1.Combo.visible=FALSE
    IF Form1.Button.Handle <> 0 THEN    Form1.Button.visible=FALSE
    If Form1.Edit.Handle   <> 0 THEN    Form1.Edit.visible=FALSE
  
    IF pItem(curSel).nItemType =  PIT_COMBO  THEN
  
        'display the combo box and move it to the new location
        nLastBox = 0
  
        IF Form1.Combo.Handle <> 0 THEN
             Form1.Combo.move(rc.left-1,rc.top-2,rc.right+2-rc.left,rc.bottom) '+100)
        END IF
  
        'add the choices for this particular property
       Dim As String cmbItems    = pItem(curSel).cmbItems
        lBoxSelText = pItem(curSel).curValue
  
           Form1.Combo.Clear
  
       Dim As String delimiter  = "|"
       Dim As Integer nCount  = Tally(cmbItems,delimiter)
  
        For i As Integer = 1 To nCount 
            Dim As ZString*2048 dataItem = PARSE(cmbItems,delimiter,i)
            'add each string to the ComboBox
               ' SendMessage(Form1.Combo.Handle,  CB_ADDSTRING, i-1, CInt(StrPtr(dataItem)) )
                  Form1.Combo.Additem(dataItem) 
        Next
  
           Form1.Combo.visible=TRUE
           Form1.Combo.SetFocus
        '  SetFocus( ghList )
  
        'jump to the property's current value in the combo box
       Dim As Integer j   = SendMessage(Form1.Combo.Handle, CB_FINDSTRINGEXACT,0,CInt(StrPtr(lBoxSelText)) )
        IF  j  <>  CB_ERR  THEN
               Form1.Combo.ItemIndex=j 
        ELSE
            'there is no current value, so default to first in list
              Form1.Combo.ItemIndex=0 
        End IF
  
    ELSEIF pItem(curSel).nItemType =  PIT_EDIT  THEN
  
        'display edit box
        nLastBox   = 1
        prevSel    = curSel
        rc.bottom = rc.bottom - 3
  
        IF Form1.Edit.Handle <> 0 Then
        	     MoveWindow( Form1.Edit.Handle,rc.left+1,rc.top+3,rc.right-rc.left,rc.bottom-rc.top,1 )
        END IF
  
        lBoxSelText = pItem(curSel).curValue
  
           Form1.Edit.visible=TRUE
           Form1.Edit.SetFocus
        '  SetFocus( ghList )
  
        'set the text in the edit box to the property's current value
           Form1.Edit.text=lBoxSelText 
  
    ELSE
        'displays a button if the property is a Color/File/Font chooser
        nLastBox = 2
        prevSel  = curSel
  
       Dim As Integer nWidth = rc.right - rc.left
  
        IF  nWidth > 25  THEN
            rc.left   = rc.right  - 25
        END IF
  
        rc.bottom = rc.bottom - 3
  
        IF Form1.Button.Handle <> 0  THEN
             MoveWindow( Form1.Button.Handle,rc.left,rc.top,rc.Right -rc.left, rc.Bottom -rc.top, 1 )
        END IF
  
           Form1.Button.visible=TRUE
           SetFocus(Form1.Button.Handle )
        '  SetFocus( ghList )
         
  
    END IF
  
 
  END  SUB 
  
 Sub TFORM1.ListBox1_MouseDown(ByRef sender As TLISTBOX,MouseButton As Integer,x As Integer,y As Integer,Shift As Integer)
 	         If Form1.Combo.Handle  <> 0 THEN   Form1.Combo.visible=FALSE
            IF Form1.Edit.Handle   <> 0 THEN    Form1.Edit.visible=FALSE
            IF Form1.Button.Handle <> 0 THEN    Form1.Button.visible=FALSE
 
            '-----------------------[ Splitter ]-----------------------
            pt.x = x
            pt.y = y
            If ((pt.x >= nDivider-5) AND (pt.x <= nDivider+5)) THEN
                'if mouse clicked on divider line, then start resizing
                 SetCursor(hCursorSize)
                  
                Dim rc AS RECT
                  GetWindowRect(Form1.ListBox1.Handle ,@rc )
                rc.left  = rc.left  +10
                rc.right = rc.right -20
 
                'do not let mouse leave the list box boundary
                  ClipCursor( @rc )
                  GetClientRect(Form1.ListBox1.Handle ,@rc )
                bTracking =  TRUE
 
                nDivTop   = rc.top
                nDivBtm   = rc.bottom
                nOldDivX  = pt.x
 
                  InvertLine( nOldDivX ,nDivTop ,nOldDivX ,nDivBtm )
 
                'capture the mouse
                  SetCapture(Form1.Listbox1.Handle)
 
            END If
 End Sub
 
 Sub TFORM1.ListBox1_Mousemove(ByRef sender As TLISTBOX,x As Integer,y As Integer,Shift As Integer)
    pt.x = x
    pt.y = y
 
            'move divider line to the mouse position
            'if columns are currently being resized
            IF bTracking =  TRUE  THEN
 
                'remove old divider line
                  InvertLine( nOldDivX ,nDivTop ,nOldDivX ,nDivBtm )
 
                'draw new divider line
                  InvertLine( pt.x ,nDivTop ,pt.x ,nDivBtm )
 
                nOldDivX = pt.x
 
            ELSE
  
                'set the cursor to a sizing cursor if
                'the cursor is over the row divider
                IF (pt.x >= nDivider-5) AND (pt.x <= nDivider+5) THEN
                      SetCursor(hCursorSize)
                       
                END IF
   
           END If
 End Sub
 
 Sub TFORM1.ListBox1_MouseUp(ByRef sender As TLISTBOX,MouseButton As Integer,x As Integer,y As Integer,Shift As Integer)
 	         pt.x = x
            pt.y =y
  
            'if columns were being resized then this indicates
            'that mouse is up so resizing is done.  Need to redraw
            'columns to reflect their new widths.
            IF bTracking =  TRUE THEN
  
                bTracking =  FALSE
                  ReleaseCapture()
                  ClipCursor( ByVal  NULL )
  
                  InvertLine( pt.x ,nDivTop ,pt.x ,nDivBtm )

  
                'set the divider position to the new value
                nDivider = pt.x
  
                'Self paint the ListBox control...
                 
                  Form1.ListBox1.Invalidate
                  updatewindow(Form1.ListBox1.Handle)
  
            END If
 End Sub
 
 Sub TFORM1.ListBox1_CaptureChanged(ByRef sender As TLISTBOX,hwnd As HWND)
 	 IF hwnd <> Form1.ListBox1.Handle THEN
      If bTracking =  TRUE THEN
         bTracking =  FALSE
         ReleaseCapture()
         ClipCursor( ByVal  NULL )
         Form1.ListBox1.Invalidate
         updatewindow(Form1.ListBox1.Handle)
      End IF
 	 End If
 End Sub
 
  SUB  TFORM1.Button_Click(ByRef sender As TBUTTON)
  	  Dim initClr        AS DWORD
     Dim currClr        AS ZString*255
     Dim clrStr         AS ZString*255
     Dim lResult        AS LONG
     Dim lCounter       AS LONG
     

  
    'display the appropriate common dialog depending on what type
    'of chooser is associated with the property
  
    'First check for the Choose Color dialog...
    IF pItem(curSel).nItemType =  PIT_COLOR  THEN
  
        currClr = pItem(curSel).curValue
  
        IF  currClr > "" THEN
  
            initClr =CInt(currClr)  
        ELSE
            'use a default instead
            initClr = clBtnFace  
        END IF
  
        
        
        Form1.Colordlg1.Parent=Form1.ListBox1
        Form1.Colordlg1.execute
        lResult= Form1.Colordlg1.color
        
        IF lResult = 0 THEN 'check if user cancelled dialog ?
           EXIT SUB
        ELSE
  
             
           clrStr = "&H" & Hex$(Cast(DWORD,lResult),6)      
           MessageBox(GetActiveWindow(),clrStr,"ok",MB_OK)
         
        
           ' clrStr ="&H" & clrStr  
          
            pItem(curSel).curValue = Str(clrStr)
  
            '  ShowWindow( ghButton, SW_HIDE )
  
               Form1.ListBox1.Invalidate
               updatewindow(Form1.ListBox1.Handle)
        END IF
  
    'Next check for the Open File Dialog...
    ELSEIF  pItem(curSel).nItemType =  PIT_FILE THEN
        Dim fName As String
        Dim SelectedFile AS ZString*255
        Dim zTxt  AS ZString * 255
  
        zTxt = "All pictures  (*.bmp,*.ico)|*.BMP;*.ICO|"
        zTxt = zTxt & "Bitmap (*.bmp)|*.BMP|"
        ZTxt = zTxt & "Icon   (*.ico)|*.ICO|"
  
      Dim As String  currPath  = pItem(curSel).curValue
        If currPath  = "none" Then
           fName  = ""
        Else
           fName  = currPath 
        End IF
  
        'use simple Open dialog for demo...
         Form1.openDialog1.caption="Select File:"
         Form1.openDialog1.FileName  =fName
         Form1.openDialog1.Filter   ="BMP"
         Form1.openDialog1.FilterIndex=1
       
        
        IF Form1.openDialog1.execute  Then
            pItem(curSel).curValue = fName 
               Form1.ListBox1.Invalidate
               updatewindow(Form1.ListBox1.Handle)
        END IF
  
'    END IF '<remove later>
  
    'Last, check for the ChooseFont() dialog...
    ELSEIF pItem(curSel).nItemType =  PIT_FONT  THEN
        lResult =Form1.FontDialog1.Execute
        IF lResult = 0 THEN 'check if user cancelled dialog ?
           EXIT SUB
        ELSE
         Dim As String   faceName    = Form1.FontDialog1.Font.Name
  
            '  ShowWindow( ghButton, SW_HIDE )
  
            ' to get the Font height... Form1.FontDialog1.Font.size
            pItem(curSel).curValue = faceName 
  
               Form1.ListBox1.Invalidate
               updatewindow(Form1.ListBox1.Handle)
  
        END IF
  
    END If
  End Sub
  
  SUB  TFORM1.combo_Click(ByRef sender As TCOMBOBOX)
               pItem(curSel).curValue =Form1.combo.SelectedText ' selStr
  End Sub
  
  SUB  TFORM1.Edit_Click(ByRef sender As TEDIT)
  	         pItem(curSel).curValue =Form1.Edit.text ' newStr
  End Sub
  
  SUB TFORM1.ListBox1_DBClick(ByRef sender As TLISTBOX)
    
 END  SUB 
  
   SUB TFORM1.ListBox1_MeasureItem(ByRef sender As TLISTBOX,ItemIndex As Integer,BYREF Height As Integer)
   	  	Height=20
   End Sub
   
  SUB TFORM1.ListBox1_DrawItem (ByRef sender As TLISTBOX,ItemIndex As Integer,State As Integer,BYREF R As Rect,DC As HDC  )
  	   
    Dim rc        AS RECT
    Dim rectFull  AS RECT
    Dim rc2       AS RECT
    Dim nIndex    AS Integer
     Dim hBrush    AS HBRUSH
      
        IF ItemIndex < 0 THEN
            EXIT Sub
        END IF
  
        IF bTracking =  TRUE THEN EXIT Sub
  
        rectFull = R
        rc = rectFull
  
        IF nDivider = 0 THEN nDivider   = (rc.right - rc.left)  \ 2
          
        rc.left   = nDivider
        rc2       = rectFull
        rc2.right = rc.left - 1
        nIndex    = ItemIndex
  
        IF  nIndex  > -1  THEN
   
            'draw two rectangles, one for each row column
            hBrush = CreateSolidBrush( BGR(192,192,192) )
              FillRect(DC , @rc2, hBrush )
              DeleteObject(hBrush)
  
              DrawEdge(DC , @rc2,  EDGE_SUNKEN, BF_BOTTOMRIGHT )
              DrawEdge(DC , @rc,   EDGE_SUNKEN, BF_BOTTOM )
  
              SetBkMode(DC ,  TRANSPARENT )
  
            rc2.left   = rc2.left   + 3
            rc2.top    = rc2.top    + 3
            rc2.right  = rc2.right  - 3
            rc2.bottom = rc2.bottom + 3
  
            'write the Property Name in the first rectangle, left side
              DrawText(DC , pItem(nIndex).propName, _
                           LEN(pItem(nIndex).propName), _
                           @rc2,  DT_LEFT OR  DT_SINGLELINE )
  
            rc.left   = rc.left   + 3
            rc.top    = rc.top    + 3
            rc.right  = rc.right  + 3
            rc.bottom = rc.bottom + 3
  
            'write the initial property value in the second rectangle, right side
              DrawText(DC , pItem(nIndex).curValue, _
                          LEN(pItem(nIndex).curValue), _
                          @rc,  DT_LEFT OR  DT_SINGLELINE )
        END If
  End Sub
  
  SUB TFORM1.BUTTON1_Click(ByRef sender As TBUTTON)
            pItem(2).curvalue="false"
        		pItem(4).curvalue="RGB(100,100,100)"
        		Form1.ListBox1.Invalidate
        		
        		updatewindow(Form1.ListBox1.Handle)
        		
  END  SUB 
  



'--------------------------------------------------------------------------
' InvertLine()
'--------------------------------------------------------------------------
SUB InvertLine( ByVal xleft1 AS INTEGER ,ByVal yFrom AS INTEGER, _
                ByVal xleft2 AS INTEGER ,ByVal yTo AS INTEGER )

  
    Dim hDC       AS HDC
    Dim nDrawMode AS LONG
    Dim oldpt     AS POINT 
  
    '*Get DC of ListBox
    hDC = GetDC( Form1.ListBox1.Handle)
  
    '*Use the default Pen color and style...
  
    '*Set the GDI foreground mix mode
    nDrawMode = SetROP2(hDC,  R2_NOT)
  
    '*Draw the Line
      MoveToEx( hDC ,xLeft1 ,yFrom ,@oldpt)
      LineTo( hDC ,xLeft2 ,yTo)
  
    '*Restore DC
      SetROP2(hDC, nDrawMode)
      ReleaseDC( Form1.ListBox1.Handle, hDC)
  
END SUB
  
'--------------------------------------------------------------------------
' User Designed Custom Control Properties:
'
'--------------------------------------------------------------------------
SUB InitializePropertyItems()
  
    pItem(0).propName  =  "ToolTip Text"
    pItem(0).curValue  =  "Litte Red Riding Hood..."
    pItem(0).nItemType =   PIT_EDIT
    pItem(0).cmbItems  =  ""
       
      Form1.ListBox1.AddItem(pItem(0).propName)
      
      
    pItem(1).propName  =  "Enabled"
    pItem(1).curValue  =  "true"
    pItem(1).nItemType =   PIT_COMBO
    pItem(1).cmbItems  =  "true|false|"
       
   Form1.ListBox1.AddItem(pItem(1).propName)
       
    pItem(2).propName  =  "Visible"
    pItem(2).curValue  =  "true"
    pItem(2).nItemType =   PIT_COMBO
    pItem(2).cmbItems  =  "true|false|"
      
      Form1.ListBox1.AddItem(pItem(2).propName)
      
    pItem(3).propName  =  "Fore. Color"
    pItem(3).curValue  = "&H" &  Hex$(Cast(DWORD,clBlack),6) '"RGB(255,255,0)"
    pItem(3).nItemType =   PIT_COLOR
    pItem(3).cmbItems  =  ""
      
       Form1.ListBox1.AddItem(pItem(3).propName)
       
    pItem(4).propName  =  "Back. Color"
    pItem(4).curValue  =  "&H" &  Hex$(Cast(DWORD,clBtnFace),6)
    pItem(4).nItemType =   PIT_COLOR
    pItem(4).cmbItems  =  ""
    
     Form1.ListBox1.AddItem(pItem(4).propName)
     
  
    pItem(5).propName  =  "Opaque"
    pItem(5).curValue  =  "false"
    pItem(5).nItemType =   PIT_COMBO
    pItem(5).cmbItems  =  "true|false|"
     Form1.ListBox1.AddItem(pItem(5).propName)
      
  
    pItem(6).propName  =  "Auto. Scroll"
    pItem(6).curValue  =  "true"
    pItem(6).nItemType =   PIT_COMBO
    pItem(6).cmbItems  =  "true|false|"
     Form1.ListBox1.AddItem(pItem(6).propName)
     
  
    pItem(7).propName  =  "Double Buffered"
    pItem(7).curValue  =  "true"
    pItem(7).nItemType =   PIT_COMBO
    pItem(7).cmbItems  =  "true|false|"
     
      Form1.ListBox1.AddItem(pItem(7).propName) 
  
    pItem(8).propName  =  "Font"
    pItem(8).curValue  =  "MS San Sarif"
    pItem(8).nItemType =   PIT_FONT
    pItem(8).cmbItems  =  ""
      Form1.ListBox1.AddItem(pItem(8).propName) 
  
    pItem(9).propName  = "Text"
    pItem(9).curValue  =  "Big Bad Wolf!"
    pItem(9).nItemType =   PIT_EDIT
    pItem(9).cmbItems  =  ""
      Form1.ListBox1.AddItem(pItem(9).propName) 
  
    pItem(10).propName  =  "Horiz. Align"
    pItem(10).curValue  =  "CENTER"
    pItem(10).nItemType =   PIT_COMBO
    pItem(10).cmbItems  =  "CENTER|LEFT|RIGHT|"
      Form1.ListBox1.AddItem(pItem(10).propName) 
  
    pItem(11).propName  =  "Vert. Align"
    pItem(11).curValue  =  "CENTER"
    pItem(11).nItemType =   PIT_COMBO
    pItem(11).cmbItems  =  "CENTER|TOP|BOTTOM|"
      Form1.ListBox1.AddItem(pItem(11).propName) 
  
    pItem(12).propName  =  "Bmp ,Icon"
    pItem(12).curValue  =  "none"
    pItem(12).nItemType =   PIT_FILE
    pItem(12).cmbItems  =  ""
      Form1.ListBox1.AddItem(pItem(12).propName) 
  
    pItem(13).propName  =  "Border Painted"
    pItem(13).curValue  =  "false"
    pItem(13).nItemType =   PIT_COMBO
    pItem(13).cmbItems  =  "true|false|"
      Form1.ListBox1.AddItem(pItem(13).propName) 
  
    pItem(14).propName  =  "Fill Content Area"
    pItem(14).curValue  =  "true"
    pItem(14).nItemType =   PIT_COMBO
    pItem(14).cmbItems  =  "true|false|"
      Form1.ListBox1.AddItem(pItem(14).propName) 
  
    pItem(15).propName  = "Focus Painted"
    pItem(15).curValue  =  "true"
    pItem(15).nItemType =   PIT_COMBO
    pItem(15).cmbItems  =  "true|false|"
      Form1.ListBox1.AddItem(pItem(15).propName) 
  
    pItem(16).propName  =  "Horiz. Text Pos."
    pItem(16).curValue  =  "RIGHT"
    pItem(16).nItemType =   PIT_COMBO
    pItem(16).cmbItems  =  "RIGHT|LEFT|CENTER|LEADING|TRAILING|"
      Form1.ListBox1.AddItem(pItem(16).propName)  
  
END SUB
 
 
 ' En fait ceci est figé pour chaque type de Control
 ' AddProperty(PIT_EDIT, "Name", btn1.Name, "",1) 
 ' AddProperty(PIT_EDIT, "Caption", btn1.Caption, "",0)                           
 ' AddProperty(PIT_EDIT, "Left ", btn1.Left , "",0)
 ' AddProperty(PIT_EDIT, "Width ", btn1.Width , "",0)
 ' AddProperty(PIT_COMBO, "Visible ", btn1.Visible  , "true|false|",0)
 ' AddProperty(PIT_COLOR, "Color  ","&H" &  Hex$(Cast(DWORD,btn1.Color),6) , "",0)
 ' AddProperty(PIT_COMBO, "Enabled ", btn1.Enabled  , "true|false|",0)
 
       
   Form1.ListBox1.AddItem(pItem(1).propName)
 sub AddProperty(PropType As Integer, PropName As String, curPropValue As String, PropList As String,flg As Integer=0)                                                                                                                                                                                                                                                                
    If flg Then ReDim pItem(0 To 0)
  Static As Integer IpropItemCount
   IpropItemCount +=1
   ReDim Preserve pItem(0 To IpropItemCount)
   
   
             pItem(IpropItemCount).propName  = PropName
             pItem(IpropItemCount).curValue  =  curPropValue
             pItem(IpropItemCount).nItemType = PropType   ' ex PIT_COMBO
             pItem(IpropItemCount).cmbItems  = PropList   ' "true|false|"   si   curPropValue type boolean 
                                                                                                                                                                                                                          
        Form1.ListBox1.AddItem(pItem(IpropItemCount).propName)  

End  sub 

Form1.FormLoad()
Application.Run
Application.Terminate
aloberoger
Posts: 507
Joined: Jan 13, 2009 19:23

Re: guitk updated

Post by aloberoger »

New version is avalable, still wainting calling static function with normal variables in a class
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: guitk updated

Post by aurelVZAB »

It seems to me that this old example have splitter control
and i need one ...but where to find ?

#Include Once "gui/gui.bi"
Post Reply