Click to See Complete Forum and Search --> : [RESOLVED] about property pages
joaquim
Apr 16th, 2008, 04:00 PM
i have building a control with some property pages.
the textbox's event change in property page have these line:
changed=true
the textbox's recive the right values but when i click for other tab(page or property page) i think that it's the same than click in apply command, why?
thanks
joaquim
Apr 16th, 2008, 04:38 PM
these part i resolve... but now i have other problem.
heres the code that i use for one property page:
Option Explicit
Dim s As Single
Private Sub chkActivarStrips_Click()
Changed = True
End Sub
Private Sub Command1_Click()
Changed = True
Call UpgradeSubimages
Timer1.Enabled = True
s = 1
End Sub
Private Sub Picture1_Click()
CommonDialog1.ShowColor
Picture1.BackColor = CommonDialog1.Color
shpSubImagem(0).BorderColor = Picture1.BackColor
End Sub
Private Sub picVisualizar_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
txtPosX = X
txtPosY = Y
Call Command1_Click
End If
End Sub
Private Sub PropertyPage_ApplyChanges()
If chkActivarStrips.Value = 1 Then
SelectedControls(0).ActualSubImage = 1
SelectedControls(0).StripsActivate = True
SelectedControls(0).StripsHeight = CLng(txtHeight.Text)
SelectedControls(0).StripsWidth = CLng(txtWidth.Text)
SelectedControls(0).StripsLeft = CLng(txtPosX.Text)
SelectedControls(0).StripsTop = CLng(txtPosY.Text)
SelectedControls(0).StripsImagesLine = CLng(txtImagensLinha)
SelectedControls(0).StripsImagesColumn = CLng(txtImagensColuna)
SelectedControls(0).StripsSeparationHorizontal = CLng(txtSeparaçãoHorizontal.Text)
SelectedControls(0).StripsSeparationVertical = CLng(txtSeparaçãoVertical.Text)
SelectedControls(0).TotalSubImage = shpSubImagem.Count - 1
End If
End Sub
Private Sub PropertyPage_SelectionChanged()
picVisualizar.Picture = LoadPicture(SelectedControls(0).FileName)
If SelectedControls(0).StripsActivate = True Then
chkActivarStrips.Value = 1
Else
chkActivarStrips.Value = 0
End If
txtHeight.Text = SelectedControls(0).StripsHeight
txtWidth.Text = SelectedControls(0).StripsWidth
txtPosX.Text = SelectedControls(0).StripsLeft
txtPosY.Text = SelectedControls(0).StripsTop
txtImagensLinha = SelectedControls(0).StripsImagesLine
txtImagensColuna = SelectedControls(0).StripsImagesColumn
txtSeparaçãoHorizontal.Text = SelectedControls(0).StripsSeparationHorizontal
txtSeparaçãoVertical.Text = SelectedControls(0).StripsSeparationVertical
End Sub
Private Sub UpgradeSubimages()
Dim i As Long
Dim Y As Long
Dim X As Long
If shpSubImagem.Count > 1 Then
For i = 1 To shpSubImagem.Count - 1
Unload shpSubImagem(i)
Next i
End If
i = 1
For Y = 1 To CLng(txtImagensLinha.Text)
For X = 1 To CLng(txtImagensColuna.Text)
Load shpSubImagem(i)
shpSubImagem(i).Visible = True
shpSubImagem(i).Left = CLng(txtPosX.Text) + IFF(X > 1, (CLng(txtWidth.Text) + CLng(txtSeparaçãoHorizontal.Text)) * (X - 1), 0)
shpSubImagem(i).Top = CLng(txtPosY.Text) + IFF(Y > 1, (CLng(txtHeight.Text) + CLng(txtSeparaçãoVertical.Text)) * (Y - 1), 0)
shpSubImagem(i).Height = CLng(txtHeight.Text)
shpSubImagem(i).Width = CLng(txtWidth.Text)
i = i + 1
Next X
Next Y
picShow.Height = CLng(txtHeight.Text)
picShow.Width = CLng(txtWidth.Text)
End Sub
Private Sub PropertyPage_Terminate()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If s >= shpSubImagem.Count - 1 Then
s = 1
Else
s = s + 1
End If
picShow.Cls
BitBlt picShow.hdc, 0, 0, shpSubImagem(s).Width, shpSubImagem(s).Height, _
picVisualizar.hdc, shpSubImagem(s).Left, shpSubImagem(s).Top, SRCCOPY
End Sub
Private Sub txtHeight_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtImagensColuna_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtImagensLinha_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtPosX_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtPosY_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtSeparaçãoHorizontal_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySubtract) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtSeparaçãoVertical_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack Or KeyAscii = vbKeySubtract) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
Private Sub txtWidth_KeyPress(KeyAscii As Integer)
If ((KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeyBack) Then
Changed = True
Else
KeyAscii = 0
End If
End Sub
the problem is that when i open these property page, after the values are initializated, the apply command is enable. can anyone tell me why?
PS: these hapens without the user change the values.
thanks
joaquim
Apr 18th, 2008, 03:17 PM
using these line:
changed=true
is the only way for enable the apply command, right?
joaquim
Apr 19th, 2008, 04:44 PM
after recived the values, i simply put these line:
changed=false
thanks to everyone
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.