DONE: Dim in Global or MainWindow

Please report bugs.

DONE: Dim in Global or MainWindow

Postby Henning » Fri Jun 17, 2011 4:32 pm

Hi,

If I declare folowing in Global, I get an "App has encountered an error..." when app ends. But if I declare it in MainWindow, where they are referenced, it's ok!?
Code: Select all
Public Dim MUX1[8] As QPushButton
Public Dim MUX2[8] As QPushButton
Public Dim MUX3[8] As QPushButton
Public Dim MUX4[8] As QPushButton
Public Dim MUX5[8] As QPushButton
Public Dim MUX6[8] As QPushButton
Public Dim MUX7[8] As QPushButton
Public Dim MUX8[8] As QPushButton
Public Dim MUX11[8] As QPushButton
Public Dim MUX12[8] As QPushButton
Public Dim MUX13[8] As QPushButton
Public Dim MUX14[8] As QPushButton
Public Dim MUX15[8] As QPushButton
Public Dim MUX16[8] As QPushButton
Public Dim MUX17[8] As QPushButton
Public Dim MUX18[8] As QPushButton
Public Dim SYSX[9] As QPushButton
Public Dim cSYSTEM[9] As QPushButton


/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: Dim in Global or MainWindow

Postby Slowdown » Sun Jun 19, 2011 7:31 am

try chancing Public to Global.
(didn't test it)
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Dim in Global or MainWindow

Postby Henning » Sun Jun 19, 2011 11:02 am

Hi,

Global Dim in Global.QObject throws a Compiler error...

Global is supposed to expose vars, functions... in all, Forms, Modules..., but Global.QObject for access without ObjectName.varname, just varname. As if declared in Global.QObject.
I use it for a few functions in modules that get called from all over the place. Like formatting packets to send as UDP.

I guess declaring Public vars/arrays of controls in Global:QObject screws up destroying objects when app shut-down.

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: Dim in Global or MainWindow

Postby Slowdown » Sun Jun 19, 2011 1:35 pm

Hi,

Global is supposed to expose vars,

Did know that, B pointed that out to me (had some troubles with working with a class)
I have started using modules for me that is the way to go.
Yes i have to call the function or Sub with Modulename[dot]function or Sub but i like the way it works.
And when looking for troubles it makes debugging more easy (again for me)
(hmmm i'm going completely off topic, sorry)
I guess declaring Public vars/arrays of controls in Global:QObject screws up destroying objects when app shut-down.

Think that isn't correct, see the example Language > Global2
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Dim in Global or MainWindow

Postby Henning » Sun Jun 19, 2011 11:49 pm

Hi,

Now I've tested several different codings.

If a variable is declared As Object in Global.QObject it is not functioning.

Tested with:
Code: Select all
Public Dim MUX1[8] As QPushButton
Public Dim MUX2[8] As QPushButton
Public Dim MUX3[8] As QPushButton
Public Dim MUX4[8] As QPushButton
Public Dim MUX5[8] As QPushButton
Public Dim MUX6[8] As QPushButton
Public Dim MUX7[8] As QPushButton
Public Dim MUX8[8] As QPushButton
Public Dim MUX11[8] As QPushButton
Public Dim MUX12[8] As QPushButton
Public Dim MUX13[8] As QPushButton
Public Dim MUX14[8] As QPushButton
Public Dim MUX15[8] As QPushButton
Public Dim MUX16[8] As QPushButton
Public Dim MUX17[8] As QPushButton
Public Dim MUX18[8] As QPushButton
Public Dim SYSX[9] As QPushButton
Public Dim cSYSTEM[9] As QPushButton
'
Public Dim MX1 As QButtonGroup
Public Dim MX2 As QButtonGroup
Public Dim MX3 As QButtonGroup
Public Dim MX4 As QButtonGroup
Public Dim MX5 As QButtonGroup
Public Dim MX6 As QButtonGroup
Public Dim MX7 As QButtonGroup
Public Dim MX8 As QButtonGroup
Public Dim MX11 As QButtonGroup
Public Dim MX12 As QButtonGroup
Public Dim MX13 As QButtonGroup
Public Dim MX14 As QButtonGroup
Public Dim MX15 As QButtonGroup
Public Dim MX16 As QButtonGroup
Public Dim MX17 As QButtonGroup
Public Dim MX18 As QButtonGroup
Public Dim SX As QButtonGroup

Public Dim Udp1 As UdpSocket
Public Dim Udp2 As UdpSocket


None of them works when accessed from Forms or Modules.

If declared in the Form that accesses them it works ok.

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: Dim in Global or MainWindow

Postby Slowdown » Mon Jun 20, 2011 6:51 pm

Hi,

I assume that these QPushButtons are not created in QtDesigner ?
Because if i place a Button on a form and don't place the 'Outlet TestBut As QPushButton' line in the code the Button still works.
Other than that i can't explain it, this one is for B i assume :?
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: Dim in Global or MainWindow

Postby Henning » Fri Jun 24, 2011 8:56 pm

Problem also with following:
Code: Select all
in Global.QObject
Type T_Msg
  bType As Byte
  ID As Int16
  bSYSTEM As Byte
  unit As Byte
  port As Byte
  bdata[8] As Byte
  ReplyTo As Int16
  crc As Int16
End Type

Public Dim TCmd As T_Msg

'* just for test
'* TCmd Type
Public Dim TCmd_bType As Byte
Public Dim TCmd_ID As Int16
Public Dim TCmd_bSYSTEM As Byte
Public Dim TCmd_unit As Byte
Public Dim TCmd_port As Byte
Public Dim TCmd_bdata[8] As Byte
Public Dim TCmd_ReplyTo As Int16
Public Dim TCmd_crc As Int16


in Module1.QObject.
Global Sub SendTSCommand(cmd As Integer)
  ....
  TxMsg = Chr(cmd)  '* this works ok.
  TxMsg = TxMsg & Chr(TCmd.ID \ 256)  '* throws runtime error number expected.

'* just for test
  TxMsg = TxMsg & Chr(TCmd_ID \ 256)  '* this works ok



So, there seems to be some serious problem vith Variables declared in Global As anything else than simple Types like Integer, Byte,String...

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: Dim in Global or MainWindow

Postby Slowdown » Sat Jun 25, 2011 7:08 am

hi,
somehow it isn't working, output of any variable from the Type is alway's 1
Tried several things none of them worked.
Will try it later today with a separate module.
keep you posted.
update:
Didn't get it working at any way.
Just trashed my Windows installation :cry:
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests