KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

This works in my .net version but not in Kixforms.dll

 
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting
View previous topic :: View next topic  
Author Message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Nov 07, 2011 6:22 pm    Post subject: This works in my .net version but not in Kixforms.dll Reply with quote

Shocked
This code snippit appears to build correctly in debug, but I get NO buttons.
My .net version works fine. Suggestions ?
Code:

Global $CNT,$COLOUR,$FNTX,$APPNAME
$T=split("Default,Mark,Mary,Maureen,Mike,Matthew",',')
$CNT=ubound($T)+1
$FNTX=7
$=Colours()
Global $SArray[2,$CNT]
For $A=0 to $CNT-1
 $SArray[0,$A]=$T[$A]
 $SArray[2,$A]=$COLOUR[$A+10]
next
$APPNAME=Form

$system = CreateObject("Kixtart.System")

$SCREENWIDTH=($SYSTEM.SCREEN.WORKINGAREA.RIGHT)
$SCREENHEIGHT=($system.screen.workingarea.bottom)
$PY=50
$wy=($cnt*3*$FNTX) + $PY
IF $cnt < 4
 $wy = 125
ENDIF
$wx=int($MaxWid*$FNTX)
IF $wx <100
 $wx = 100
ENDIF
If $wy > $SCREENHEIGHT
 $Columns=cint(($wy-$PY)/($SCREENHEIGHT-$PY))+1
 $wy=$PY+(cint(($wy-$PY)/$Columns))
 $WX=$columns*(($MaxWid*$FNTX)+4)
Endif
Dim $mainform,$sfull,$swind,$cons0,$tools,$adini,$adlab,$edini
$mainform = $system.form
$mainform.text = "Buttons [" + ($cnt - 1) +"]"
$mainform.size = $wx + 106,$wy + 15 ;Width,Height
$mainform.maximizebox = "false"
$mainform.minimizebox = "true"
$mainform.BackColor = 240,240,240
$mainform.StartPosition = 5
$mainform.Activate
$mainform.SetFocus
If Exist(@scriptdir+'\'+$APPNAME+'.ico')
 $mainform.icon = $system.icon(@scriptdir+'\'+$APPNAME+'.ico')
EndIf

$ = MakeBtns('mainform')

$mainform.show
WHILE $mainform.visible
 $=Execute($mainform.doevents())
LOOP
Exit

FUNCTION MakeBtns($FormName)
  Dim $A,$V, $W, $X, $Y, $Z, $BX, $BY, $C, $T, $Buttn
  $W=INT(($CNT-1)/$Columns)+1
  $Z=$W
  $V=1
  $X=int($MaxWid*$FNTX)
  IF $X<100
   $X=100
  ENDIF
  $Y=20
  $BY=4
  $BX=4
  FOR $A = 1 TO $CNT-1
   If $A>$Z
    $Z=$Z+$W
    $V=$V+1
    $BX=$BX+$x+4
    $BY=4
   Endif
   $C=$SArray[2,$A]
   $T=$SArray[0,$A]
   $Buttn="PB"+$A
;   $=setoption('Explicit','OFF')
;   $_ = execute('$$$Buttn = $$$FormName.Controls.Button($$T,$$BX,$$BY,$$X,$$Y)')
debug on
   $_ = execute('$$$Buttn = $$$FormName.Controls.Add("Button")')
   $_ = execute('$$$Buttn.width = $X')
   $_ = execute('$$$Buttn.height = $Y')
   $_ = execute('$$$Buttn.top = $BY')
   $_ = execute('$$$Buttn.left = $BX')
   $_ = execute('$$$Buttn.ForeColor = $$System.Color.$C')
;   $_ = execute('$$$Buttn.OnClick = "BtnSelct($$A)"')
;   $=setoption('Explicit','ON')
   $BY=$BY+(3*$FNTX)
  NEXT
ENDFUNCTION

FUNCTION Colours()
$COLOUR=split("ActiveBorder,ActiveCaption,ActiveCaptionText,AliceBlue,AntiqueWhite,AppWorkspace,Aqua,Aquamarine,Azure,Beige,Bisque,Black,BlanchedAlmond,Blue,BlueViolet,Brown,BurlyWood,CadetBlue,Chartreuse,Chocolate,Control,ControlDark,ControlDarkDark,ControlLight,ControlLightLight,ControlText,Coral,Cornsilk,Crimson,Cyan,DarkBlue,DarkCyan,DarkGoldenrod,DarkGray,DarkGreen,DarkKhaki,DarkMagenta,DarkOliveGreen,DarkOrange,DarkOrchid,DarkRed,DarkSalmon,DarkSeaGreen,DarkSlateBlue,DarkSlateGray,DarkTurquoise,DarkViolet,DeepPink,DeepSkyBlue,Desktop,DimGray,DodgerBlue,Firebrick,FloralWhite,ForestGreen,Fuchsia,Gainsboro,GhostWhite,Gold,Goldenrod,Gray,GrayText,Green,GreenYellow,Highlight,HighlightText,Honeydew,HotPink,HotTrack,InactiveBorder,InactiveCaption,InactiveCaptionText,IndianRed,Indigo,Info,InfoText,Ivory,Khaki,Lavender,LavenderBlush,LawnGreen,LemonChIIFon,LightBlue,LightCoral,LightCyan,LightGoldenrodYellow,LightGray,LightGreen,LightPink,LightSalmon,LightSeaGreen,LightSkyBlue,LightSlateGray,LightSteelBlue,LightYellow,Lime,LimeGreen,Linen,Magenta,Maroon,MediumAquamarine,MediumBlue,MediumOrchid,MediumPurple,MediumSeaGreen,MediumSlateBlue,MediumSpringGreen,MediumTurquoise,MediumVioletRed,Menu,MenuText,MidnightBlue,MintCream,MistyRose,Moccasin,NavajoWhite,Navy,OldLace,Olive,OliveDrab,Orange,OrangeRed,Orchid,PaleGoldenrod,PaleGreen,PaleTurquoise,PaleVioletRed,PapayaWhip,PeachPuff,Peru,Pink,Plum,PowderBlue,Purple,Red,RosyBrown,RoyalBlue,SaddleBrown,Salmon,SandyBrown,ScrollBar,SeaGreen,SeaShell,Sienna,Silver,SkyBlue,SlateBlue,SlateGray,Snow,SpringGreen,SteelBlue,Tan,Teal,Thistle,Tomato,Transparent,Turquoise,Violet,Wheat,White,WhiteSmoke,Window,WindowFrame,WindowText,Yellow,YellowGreen",',')
ENDFUNCTION
Back to top
View user's profile Send private message
enahsyemotp
KiXforms Regular
KiXforms Regular


Joined: 22 Sep 2010
Posts: 40
Location: Tulsa, OK

PostPosted: Mon Nov 07, 2011 8:16 pm    Post subject: Reply with quote

Try removing the $mainform from your DIM line. It's making it inaccessible to your button function.
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Tue Nov 08, 2011 9:36 am    Post subject: Reply with quote

Laughing
Well spotted, a double declaration.
I have the forms set to Global throughout so cross functions scope but had missed this additional declaration.
I am suprised that $=setoption('Explicit','ON') did not error on the re-declaration...humm

Thanks a lot; Amazing what a fresh pair of eyes can do Razz
Back to top
View user's profile Send private message
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Sun Nov 13, 2011 11:46 pm    Post subject: Dup Definition Reply with quote

Using KGen or at least funning the Sanity UDF would catch this and many more issues.

Glenn
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group