Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Virtual mode + msgbox = empty ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Virtual mode + msgbox = empty ?

 Post Reply Post Reply
Author
Message
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Topic: Virtual mode + msgbox = empty ?
    Posted: 27 June 2009 at 6:08pm
Hello.
When i use the virtual mode and show a msgbox the report control become empty ! When i close the msgbox the report data is back...
Is this "normal" ?
You can try with the sample..
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2009 at 1:55am
Hi,
 
Yes, it's normal.
 
In virtualmode you have only one record, right? You only added one record and assigned value to wndReportControl.SetVirtualMode 100. Basicly you are telling the RC you want to have events for 100 rows (0 to 99) in BeforeDrawRow event. So everytime the RC needs to be redrawn, you will get events of BeforeDrawRow event for every single item that is in RC (only for visible rows and cols in RC) Now, if a VB messagebox appears the program stops executing the BeforeDrawRow events (also "normal" behaviour, you are waiting for an action of the user, user presses OK or Cancel the code after msgbox will be executed) and clears all drawn items just before msgbox appears (this is a guess, if you really want to know ask CJ developer) Msgbox is closed and program will execute BeforeDrawRow events again (for every single (visible) item in RC) and voila you're RC has been filled with data again.
 
CJ can't do anything about it but CJ can help you getting around this. Use the CJ TaskDialog instead of a VB MsgBox and BeforeDrawRow events keep firing   
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2009 at 4:09pm
Dear Aaron,

The 'Normal' attribute of the problem seems a little strange anyway right ?  
When you tell me that a msgbox erases the contents of the report, i can understand (technically) but this need a big "WARNING" in the online help about the "Virtual Mode" ... No?

If there is really no solution I will have to pass my way back to my old component that uses a similar method without this kind of problem ... I'm so sad ! But thank you for this fast and complete reply !
 
I'll send a post about a but of "virtual mode" and selectedrows tomorrow... Need to make a sample and a video to explain.
 
 
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2009 at 3:35am
Originally posted by Lodep59 Lodep59 wrote:

I'll send a post about a but of "virtual mode" and selectedrows tomorrow... Need to make a sample and a video to explain.
 
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 12:11am
Absolutely not. See snapshot - 10000 records in virtual mode report. About is Message Box - right?
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 12:33am
Hello,
 
No sorry, it's a modal form, not a msgbox (the function in VB6).
When i show a modal form, it's ok, a msgbox, not.
The solution provided by Aaron works (TaskDialog) but it's not perfect. My users are disturbed by the taskdialog look for simple msgbox.
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 9:30am

It was MFC app and now - VB App with usual MsgBox call (without TOPMOST style like Task Manager used sometimes)
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 5:20pm
If you wrap the API MessageBox function to take the same parameters as the VB6 MsgBox, then it seems to work:


Private Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

Public Function RcMsgBox(ByVal Prompt As String, ByVal Buttons As VbMsgBoxStyle, ByVal Title As String) As VbMsgBoxResult
   RcMsgBox = MessageBox(Me.hwnd, Prompt, Title, Buttons)
End Function


Just call RcMsgBox the way you would call MsgBox (minus the help file and context parameters. If you need those, then you will need to implement them yourself).
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 5:27pm
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 5:39pm

The next version of the Report Control allow you to show std msgbox without being empty BUT it don't seems to works if the msgbox is shown by menu or on event associated with the form (checked by me with form_unload). It works if you show msgbox on button click (verified by the Mark sample).

I'll try the API way. Thanks for the tip. :-)

Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 5:50pm
Don't be naive - there is nothing in new version of Report Control related to MsgBox behaviour - belive me...
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 7:20pm
Originally posted by mdoubson mdoubson wrote:

Don't be naive - there is nothing in new version of Report Control related to MsgBox behaviour - belive me...
 
Ok... I'm so naive... So, there's no change in the new version of the report control about the msgbox. The report control wasn't and isn't able to manage msgbox correctly, except if you show the msgbox by clicking a button.
 
Yes, it's better like this.
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 9:22pm
I repeat - the problem is not in MsgBox - in VB Menu handling
try this function
 
Private Sub wndReportControl_SelectionChanged()
    Dim i As Long
    i = Me.wndReportControl.SelectedRows.Count
    If i = 10 Then MsgBox "SelectedRows.Count " & i
End Sub
and you will see picture:
 
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2009 at 2:31am
And i repeat, there's also many others case in wich the report is cleared !
Not only by menu.
 
On the "form_queryunload" event, add a msgbox and you'll see the report is cleared !
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2009 at 8:00pm

At least you see the case when app call MsgBox itself by situation reached - no buttons and no user action involved but view is OK?!

Btw - did you try same situation in more recent development tools - like VC# or VB.NET?
 
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2009 at 4:27am
Originally posted by mdoubson mdoubson wrote:

Btw - did you try same situation in more recent development tools - like VC# or VB.NET?
 
No sorry. That's why I use ActiveX versions.
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2009 at 11:01am
Hi Mark,
 
I've found a "solution" for this problem !
Seems that if you set the focus to an other control (not the report control) the msgbox is shown without problem !
That's the reason why you don't have the problem with button's showing msgbox, the button got the focus before calling the msgbox !
 
Check my sample :
 
I've just added a simple textbox on the bottom of the screen.
Run the sample and (without doing anything else), go to menu "Report Control" / "Count selected".
You'll see 2 msgbox :
 
  1. The fisrt is shown with the focus on report control (the report on background is empty --> Bug)
  2. The second is show with the focus on the textbox (--> OK)
 
Don't know why but this may help you ?
 
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2009 at 11:49am
No clear - when MsgBox called inside code (on Selection Change) it does not change focus before MsgBox popuped and don't use some other UI elements
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2009 at 11:58am
Originally posted by mdoubson mdoubson wrote:

No clear - when MsgBox called inside code (on Selection Change) it does not change focus and don't use some other UI elements
 
Sorry i don't understand what you mean ?
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2009 at 12:02pm
See my prev snapshot with piece of code used to call MsgBox
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2009 at 12:14pm
Yes, i've seen but i also confirm that if i set the focus to other control before showing msgbox the problem disappear !
Don't know why but may be this could help you to find a solution ?
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 12 July 2009 at 11:05am

Private Sub wndReportControl_SelectionChanged()
    Dim Row As ReportRow
    Dim a As Integer
    On Error Resume Next
    Debug.Print "Selection Changed. Focused Row = " & wndReportControl.FocusedRow.Index
   
    Me.Caption = wndReportControl.SelectedRows.Count & " row(s) selected"
   
    If (wndReportControl.SelectedRows.Count < 10) Then
        For Each Row In wndReportControl.SelectedRows
            Debug.Print "Selected: " & Row.Index
        Next
    End If

    If (wndReportControl.SelectedRows.Count = 10) Then
        a = 0
        For Each Row In wndReportControl.SelectedRows
            'Debug.Print "Selected: " & Row.Index
            a = a + 1
        Next
        MsgBox a
        'MsgBox wndReportControl.SelectedRows.Count
    End If
End Sub
 
Snapshot show that MsgBox popup before redraw happened on my last selection action - count already 10 but highlighted only prev selection
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.