OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 24-10-2012, 13:42
byteme67's Avatar
byteme67 byteme67 is offline
Junior Member
 
Join Date: Apr 2010
Location: Fort Misery
Posts: 25
Default Multipage textbox focus

Okay I have looked read and tried different examples of trying to setfocus to any field on the userform if it is empty. The following is what I have come up with so far and I get an error trying to get to my page2 of the multipage userform. At the last minute I threw in the Me.frmProofInfo.value = 0 but that doesn't work either.

As usual any help or direction is appreciated.
*edit
I added the line Me.frmProofInfo.Show as well. If I take those lines out the focus to page1 works fine. It is still trying to get focus on page2.
Code:
Private Sub cmdOk_Click()
    'Ok button was clicked now do the following
    ActiveWindow.ActiveView.ToFitPage
    
    'check if any textbox is empty of information needed
    'added this section 2012.10.24
    Me.frmProofInfo.Value = 0
    If txtJobSummary.Value = "" Then
        MsgBox "We could use a job description here!"
        Me.frmProofInfo.Show
        Me.txtJobSummary.SetFocus
        Exit Sub
    ElseIf cmbFilename.Value = "" Then
        MsgBox "If we don't know the filename how are we supposed to revise anything if needed!"
        Me.frmProofInfo.Show
        Me.cmbFilename.SetFocus
        Exit Sub
    ElseIf txtFilename.Value = "" Then
        MsgBox "If we don't know the filename how are we supposed to revise anything if needed!"
        Me.frmProofInfo.Show
        Me.txtFilename.SetFocus
        Exit Sub
    End If
    
    Me.frmProofInfo.Value = 1
    If txtContact.Value = "" Then
        MsgBox "We really need to know who this is going to!"
        txtContact.SetFocus
        Exit Sub
    ElseIf txtBusiness.Value = "" Then
        MsgBox "Umm is there no business?!?"
        txtBusiness.SetFocus
        Exit Sub
    ElseIf txtEmail.Value = "" Then
        MsgBox "Most people usually have an email these days!"
        txtEmail.SetFocus
        Exit Sub
    End If

Last edited by byteme67; 24-10-2012 at 13:49.
Reply With Quote
  #2  
Old 25-10-2012, 12:30
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Is it possible you either attach the gms so we can test, or at least a mock up gms with form demonstrating problem. This would be easier to test.

~John
Reply With Quote
  #3  
Old 12-11-2012, 09:54
byteme67's Avatar
byteme67 byteme67 is offline
Junior Member
 
Join Date: Apr 2010
Location: Fort Misery
Posts: 25
Default

sure here it is.
Attached Files
File Type: gms ProofSheet.gms (58.0 KB, 184 views)
Reply With Quote
  #4  
Old 12-11-2012, 11:30
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I was having some luck with this:

Code:
Private Sub setFocus()
    Dim c As Control
    For Each c In Me.Controls
        If c.Width = 78 Or c.Width = 354 Or c.Width = 360 Or c.Width = 160 Or c.Width = 192 Then
            If c.Value = "" Then
                c.setFocus: Exit Sub
            End If
        End If
    Next c
End Sub
You can put in an event, or just when form loads.

I also had to change alot of things in your code to make macro start, like:


Code:
Private Sub mpageProof_Change()
    On Error Resume Next '<<<<<<<<<<<<<<<<<<added this
    Select Case mpageProof.Value
        Case 0
            'Call viewpageinfo
                ActiveDocument.Views("Proof Info").Activate
        Case 1
            'Call viewpagecontact
            ActiveDocument.Views("Proof Area").Activate
        Case Else
            'Do Nothing
    End Select

End Sub
Code:
    'check if Additional Page layer is active
    If Not ActivePage.Layers.Find("Additional Page") Is Nothing Then '<<<aded this If Statement
        ActivePage.Layers("Additional Page").Activate
        chkAddlPgs.Value = ActivePage.Layers("Additional Page").Visible
    End If

    

    'check if Enlarged layer is active
    If Not ActivePage.Layers.Find("Enlarged") Is Nothing Then '<<<aded this If Statement
        ActivePage.Layers("Enlarged").Activate
        chkEnlarged.Value = ActivePage.Layers("Enlarged").Visible
    End If
~John
Reply With Quote
  #5  
Old 07-02-2013, 14:45
byteme67's Avatar
byteme67 byteme67 is offline
Junior Member
 
Join Date: Apr 2010
Location: Fort Misery
Posts: 25
Default

Thanks John! I am assuming the few suggested lines were more for error trapping. I am not to good at that.

But I am curious on the is the c.width the position of the control on the page?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Focus question xombie CorelDRAW/Corel DESIGNER VBA 6 20-09-2010 16:38
set focus on a commandBarControl biok CorelDRAW/Corel DESIGNER VBA 1 26-08-2009 13:27
Return Focus to Text Box cooloox CorelDRAW/Corel DESIGNER VBA 4 31-03-2009 03:25
Textbox in Form and Passing Control Focus. knowbodynow CorelDRAW/Corel DESIGNER VBA 4 23-05-2008 23:39
Closing a form when something else gets focus Gadget CorelDRAW/Corel DESIGNER VBA 3 23-01-2008 06:51


All times are GMT -5. The time now is 08:12.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com