-
Window>Docu 1,docu 2,docu 3 Ect Ect
Hello all: included a small code for you to look at :
VB Code:
Private Sub tbToolBar_ButtonClick(ByVal Button As MSComCtlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "New"
LoadNewDoc
Case "Open"
mnuFileOpen_Click
Case "Save"
mnuFileSave_Click
Case "Print"
mnuFilePrint_Click
Case "Cut"
mnuEditCut_Click
Case "Copy"
mnuEditCopy_Click
Case "Paste"
mnuEditPaste_Click
Case "Bold"
ActiveForm.rtfText.SelBold = Not ActiveForm.rtfText.SelBold
Button.Value = IIf(ActiveForm.rtfText.SelBold, tbrPressed, tbrUnpressed)
Case "Italic"
ActiveForm.rtfText.SelItalic = Not ActiveForm.rtfText.SelItalic
Button.Value = IIf(ActiveForm.rtfText.SelItalic, tbrPressed, tbrUnpressed)
Case "Underline"
ActiveForm.rtfText.SelUnderline = Not ActiveForm.rtfText.SelUnderline
Button.Value = IIf(ActiveForm.rtfText.SelUnderline, tbrPressed, tbrUnpressed)
Case "Align Left"
ActiveForm.rtfText.SelAlignment = rtfLeft
Case "Center"
ActiveForm.rtfText.SelAlignment = rtfCenter
Case "Align Right"
ActiveForm.rtfText.SelAlignment = rtfRight
Case "Back"
'another todo,add the screen back code
Case "Forward"
'ToDo: Add 'Forward' button code.
'So i want this button to move 1 Forward like from Document 1 towards document 2(without opening a new instance Just to goto the next one)
MsgBox "Add 'Forward' button code."
End Select
Okay what i want the forward and back code to do is move to the next instance of frmbrowser(like when you click on Windows> frmbrowser1 and then plus one)I hope you understand,Help me please :-(
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Sounds like your trying to create your own MDI 'type' web app?
How are you keeping track of the instances?
-
1 Attachment(s)
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Uhm..okay i just used the wizzard in VB 6.0 enterprise and made a MDI project with IE form,deleted frmdocument and made it all point at Frmbrowser ;) i included the source so you can see what i want to do..
(thanks for responding)
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Ok, probably change the LoadNewDoc procedure so the frmD is public to the
app by declaring it Public in Module1 Declarations section. Then you can use
the .Tag propert of the form to keep track of the instance number. Then in
the next and back nuttons you would just need to show or hide to desired
tag form number desired.
HTH
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
And i would do that like this ?
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
You can iterate through the Forms collection that you are creating and
check the tag property. Then when you get the one you need do a
frmD.Show
VB Code:
For Each frm In Forms
If frm.Tag = 3 Then
frm.Show
End If
Next
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
I dont understand :-( okay i put this in the module :
Public frmD As frmBrowser
Then added your code like this:
VB Code:
Case "Back"
For Each frmD In frmBrowser
If frmD.Tag = 2 Then
frmD.Show
End If
Next
Im a n00b :'(
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
you have to search thru Forms, and use frm to check each one. then you check the tag of the frm, like RobDog did.
just paste his code
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Okay...now..in english ?..i really dont understand,..:-( have a sample prog/code for me ?:( thats easier then robs..coz rob just rocks
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Place this code as your Module1 and remove the "Static lDocumentCount As Long" from your LoadNewDoc procedure.
VB Code:
Public fMainForm As frmMain
Public frmD As frmBrowser
Public lDocumentCount As Long
Sub Main()
Set fMainForm = New frmMain
fMainForm.Show
End Sub
Then we need something to keep track of the history so we can go back and fourth through it.
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Okay..done that..pretty much looking it over at first to undersatdn..if i am correct i need to add this to the 'back' ?
VB Code:
Case "Back"
For Each frmD In Forms
If frmD.Tag = 3 Then
frmD.Show
Or else?:( im sorry if i am asking to much guys..its just for a girl i know
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
It would be something like this but I think there is a better way.
VB Code:
'Declare mlCurrentindex in the forms General declarations section.
Case "Back"
mlCurrentindex = IIf(mlCurrentindex = 0, 0, mlCurrentindex - 1)
For Each frm In Forms
If frm.Tag = mlCurrentindex Then
frm.Show
Exit For
End If
Next
Case "Forward"
mlCurrentindex = IIf(mlCurrentindex = lDocumentCount, lDocumentCount, lDocumentCount + 1)
For Each frm In Forms
If frm.Tag = mlCurrentindex Then
frm.Show
Exit For
End If
Next
End Select
'And this would be you Loadnewdoc procedure.
Private Sub LoadNewDoc()
lDocumentCount = lDocumentCount + 1
Set frmD = New frmBrowser
frmD.Tag = lDocumentCount
frmD.Caption = "Document " & lDocumentCount
frmD.brwWebBrowser.GoHome
mlCurrentindex = mlCurrentindex + 1
frmD.Show
End Sub
On second thought I think there is a way to call the menu Window click event
to simulate the user clicking Window 1 or 2 or whatever the order would be. I
need to go to a meeting righ now. so I wil be back in a few hrs.
HTH
-
1 Attachment(s)
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Hey sorry for the late response,it didnt work ! :'( well it doesnt give any errors at all,but it does nothing like switching windows :-( have i made an impossible question ? included the new version of happy browser,to maybe see what i did wrong ?
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Hey Neo, I'm back. I just wanted to let you know that I am looking into a
method to switch windows easier. I remember there is something with the
Window menu that we can do. I'll be back with a post in a while.
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Ah okay cool,i think allot of people could use this sorta code at the moment =P i gave you some 'rating'on there too i hope you'll get it to work and to hear from you soon,im trying to find it out myself but i aint good in looking(lol)
Hope to hear from you soon-Neo
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
I found a link on MDI forms that I think you may like.
Also, there is a short cut key sequence that you can send to navigate
between the windows, but I cant remember what it is. Maybe someone else
remembers it? That would be allot easier then writting your own procedure to
navigate between instances.
HTH
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Doh! Remembered it. Send the keys Alt + W + (the index number of the Windowed menu list to display).
Ex.
Will send Alt + W + 2 to change to the second child form.
You can use SendMessage which is more reliable, but for demo I just showed SendKeys.
HTH
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
so its just:
VB Code:
case "back"
SendKeys "{%W2}", True
Gawd im so confused :-( :cry: :eek2: :sick: Coz it didnt work :'(
-
1 Attachment(s)
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Sorry for the confusion, but if you look at the Window menu you will see that
it contains a list of the open child windows. There are shortcuts visible with
the underlining of the index numbers usually by pressing the Alt key. Then if
you press the desired window number it will bring that window as the active
child window.
HTH
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
Yes i understood that,but the code doesnt work :-( im tried sendkeys and sendmessage,but none worked
VB Code:
Case "Back"
SendKeys "{%W2}", True
Case "Forward"
what should i change...?
-
Re: Window>Docu 1,docu 2,docu 3 Ect Ect
You need to send the number of the window that you want to become active.
You must also have that window number already loaded too.
VB Code:
Case "Back"
SendKeys "{%W2}", True 'Activate the second child window
'Or
'SendKeys "{%W1}", True 'Activate the first child window
Case "Forward"
The only drawback for SendKeys is that the window must be the one with the current focus (active).
HTH