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

DEPRECIATED Functions and their Alternatives.

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


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

PostPosted: Thu Jan 25, 2007 9:28 am    Post subject: DEPRECIATED Functions and their Alternatives. Reply with quote

DOES THERE EXIST A REVISIONS AND UPDATES LIST OF FUNCTIONS WHICH ARE DEPRECIATED OR EVEN NO LONGER SUPPORTED, THEIR REPLACEMENTS AND/OR DEVELOPING 'BEST PRACTICES' ?

As like many I make an infrequent trip to KIXland and thereby fall foul of trying to implement older examples and methodologies with the current KIX versions and spend ages trying to understand why things won't work.

I have been using successfully code like:

setoption("NoVarInString","Off")
$lbc = "$C" + right($text,-1)
$size = len($cn)
$_ = execute("$$#$LBC.Text = $TBSize - $Size")

= efficient recursive form and button generation.
I am now told this is a 'OH NO' but have no alternative to look towards.
In fact the latest KIXForm.dll from Shaun does not work with this type of code, had to revert to a previous version to keep things running.

If it does not exist, would Shaun and everyone who actually writes builds consider adding their input to a thread FAQ so the rest of us may have a handle on what we should be looking to achieve !
________
Zx14 vs hayabusa


Last edited by MACE1 on Fri Feb 18, 2011 5:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jan 25, 2007 10:05 pm    Post subject: Reply with quote

Can you do me a favor ... this line here:

$_ = execute("$$#$LBC.Text = $TBSize - $Size")

just before it, can you add this line:

? "$$#$LBC.Text = $TBSize - $Size"

And post the displayed string from the console to this thread ... think it would really be helpfull to see the translated version ... its hard to make sense of "executed" code without all the "context" ...

-Shawn
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: Fri Jan 26, 2007 2:30 pm    Post subject: Reply with quote

This is a standard function which was developed a while back and is used regularly to create input fields on forms... It does not appear to like the latest builds.

$N=left("%username%",1)+right("%username%",1)
BldPForm(110,10,"Created By",4,"T_CREATEDBY","TA",,,$N)
BldPForm(110,40,"Project Manager",3,"T_PROJECTMANAGER","TA",,,$N)
etc

Code:

   ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   FUNCTION BldPForm($lx,$ly,$label,$tbsize,$vlabel,OPTIONAL $fmt, OPTIONAL $ml, OPTIONAL $count, OPTIONAL $seedval )
    ;Note $$# is a means of getting execute to resolve correctly.
    $tbn="$"+$vlabel
    $lbl="$L"+right($vlabel,-1)
    IF $count <> ""
     $lbc = "$C" + right($vlabel,-1)
     $_ = execute("$$#$LBC = $$PForm.label()")
     $_ = execute("$$#$LBC.fontsize=8")
     $_ = execute("$$#$LBC.Height = 24")
     $_ = execute("$$#$LBC.Top = $$LY + 5")
     $_ = execute("$$#$LBC.Left = $$LX + 6 + ($$TBSize * 13)")
     $_ = execute("$$#$LBC.FontBold = 0")
     $_ = execute("$$#$LBC.TextAlign = 0")
    ENDIF

    IF $ml="" $ml="0"
    ENDIF
    IF $fmt="" $fmt="GT"
    ENDIF
    $_ = execute("$$#$TBN = $$PForm.TextBox()") ;<<See Console Output from this point<<
    $_ = execute("$$#$TBN.MultiLine = $$ML")
    $_ = execute("$$#$TBN.Width = ($$TBSize * 13)+4")
    $_ = execute("$$#$TBN.Height = 28")
    $_ = execute("$$#$TBN.Left = $$LX")
    $_ = execute("$$#$TBN.Top = $$LY")
    $_ = execute("$$#$TBN.TextAlign = 0")
    $_ = execute("$$#$TBN.AcceptsReturn = 'FALSE'")
    $_ = execute("$$#$TBN.fontsize= 12")
    $_ = execute("$$#$TBN.Opacity = 100")
    $_ = execute("$$#$TBN.MaxLength = $$TBSize")
    $_ = execute("$$#$TBN.text = $$Seedval")
    IF $fmt = "YY" OR $fmt = "YYYY" OR $fmt = "DD" OR $fmt = "MM"
     $_ = execute("$$#$TBN.OnLostFocus = 'FillForm($Vlabel,$Fmt,)'")
    ELSE
     IF $count <> ""
      $_ = execute("$$#$TBN.OnTextChanged = 'FillForm($Vlabel,$Fmt,$TBSize)'")
      $_ = execute("$$#$TBN.OnLostFocus = 'TXTTrim($Vlabel,$TBSize)'")
     ELSE
      $_ = execute("$$#$TBN.OnTextChanged = 'FillForm($Vlabel,$Fmt,)'")
      $_ = execute("$$#$TBN.OnLostFocus = 'TXTTrim($Vlabel,)'")
     ENDIF
    ENDIF
    $_ = execute("$$#$LBL = $$PForm.label()")
    $_ = execute("$$#$LBL.Text = $$Label")
    $_ = execute("$$#$LBL.MultiLine = $$ML")
    $_ = execute("$$#$LBL.fontsize=8")
    $_ = execute("$$#$LBL.Width = len($$Label) * 13")
    $_ = execute("$$#$LBL.Height = 24")
    $_ = execute("$$#$LBL.Top = $$LY + 5")
    $_ = execute("$$#$LBL.Right = $$LX - 5")
    $_ = execute("$$#$LBL.FontBold = 0")
    $_ = execute("$$#$LBL.TextAlign = 4")

   ENDFUNCTION
   ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Console Output following execute(#) using 2.3.0.45 build:
$#$T_CREATEDBY = $PFprm.TextBox()
$T_CREATEDBY = $PFprm.TextBox()

$#$T_CREATEDBY.Multiline = $ML
$T_CREATEDBY.Multiline = $ML

$#$T_CREATEDBY.Width = ($TBSize * 13)+4
$T_CREATEDBY.Width = ($TBSize * 13)+4

etc

This is the function which brought the problem to my attention...

GLOBAL $sarray[99,5]
GLOBAL $CNT
;read in values into array... say $CNT=7

Code:

   $wy=($cnt*22) + 40
   IF $cnt < 4 $wy = 125
   ENDIF
   $wx=($wid*9)
   IF $wx <100 $wx = 100
   ENDIF

   $system = CreateObject("Kixtart.System")
   $mainform = $system.form()
   $mainform.caption = "Selections [" + $cnt + "]"
   $mainform.width = $wx + 110
   $mainform.height = $wy + 10
   $mainform.topmost = "true"
   $mainform.maximizebox = "false"
   $mainform.minimizebox = "false"
   $mainform.center

   MakeBtns($wx,$wy)
   ; other buttons etc

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



Code:

 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 FUNCTION MakeBtns($wx,$wy)
  FOR $x = 1 TO $cnt
   $Button="BtnNo"+$x
   $bx=($x*22)-15
   execute("$$$Button= $$MainForm.Controls.Button()")  ;See Console evaluation below
   execute("$$$Button.text = $$SArray[$$x,0]")
   execute("$$$Button.Height = 20")
   execute("$$$Button.Width = $$WX")
   execute("$$$Button.Left = 8")
   execute("$$$Button.Top = $$BX")
   execute("$$$Button.onclick = 'OnClick($X)'")
  NEXT
 ENDFUNCTION


Console Evaluation;
$BtnNo1 = $MainForm.Controls.Button()
$BtnNo1 = $SArray[$x,0]
etc

Hope this is what is required.
NB: Is there a means known in debug to stream the console output to a file instead of manual stepping it and typing displayed results ?
________
Colorado Marijuana Dispensary


Last edited by MACE1 on Fri Feb 18, 2011 5:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 26, 2007 9:04 pm    Post subject: Reply with quote

I took the bits of code and re-worked it into a little test script, here's what I have so far ... not sure I see what the problem is though ... can you re-work to demonstrate ?

Code:

GLOBAL $SArray[99,5]
GLOBAL $CNT

$wid = 30

$SArray[1,0] = "Button1"
$SArray[2,0] = "Button2"
$SArray[3,0] = "Button3"
$SArray[4,0] = "Button4"
$SArray[5,0] = "Button5"

$cnt = 5

$wy=($cnt*22) + 40
IF $cnt < 4
 $wy = 125
ENDIF
$wx=($wid*9)
IF $wx <100
 $wx = 100
ENDIF

$system = CreateObject("Kixtart.System")
$mainform = $system.form()
$mainform.caption = "Selections [" + $cnt + "]"
$mainform.width = $wx + 110
$mainform.height = $wy + 10
$mainform.topmost = "true"
$mainform.maximizebox = "false"
$mainform.minimizebox = "false"
$mainform.center

MakeBtns($wx,$wy)

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

Function OnClick($x)

 ?"Clicked button " + $x

EndFunction

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTION MakeBtns($wx,$wy)
  FOR $x = 1 TO $cnt
   $Button="BtnNo"+$x
   $bx=($x*22)-15
   $= execute("$$$Button= $$MainForm.Controls.Button()")  ;See Console evaluation below
   $= execute("$$$Button.Text = $$SArray[$$x,0]")
   $= execute("$$$Button.Height = 20")
   $= execute("$$$Button.Width = $$WX")
   $= execute("$$$Button.Left = 8")
   $= execute("$$$Button.Top = $$BX")
   $= execute("$$$Button.onclick = 'OnClick($X)'")
  NEXT
ENDFUNCTION
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: Mon Jan 29, 2007 9:47 am    Post subject: Confusing it certainly is... Kixforms.dll Reply with quote

Using 2.46.55.0 I get no visible buttons.
Using 2.3.0.45 Everything looks fine.

It is probably my mixture/selection of code components which don't match properly but whereas things appear to 'evaluate' correctly I get no buttons visible.
________
Free Joomla Themes


Last edited by MACE1 on Fri Feb 18, 2011 5:07 pm; edited 1 time in total
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: Mon Jan 29, 2007 10:12 am    Post subject: The plot thickens.... Reply with quote

I have accidentally discovered things were not quite as first described.
It turns out the buttons were being created, they were simply not visible. If you click where they should be then you get the buttons and it registers the apropriate event.
This is probably my inexperience in kix so if anyone is interested, I attach the core of a primary script in which I use this recursive button idea.
It is a simple project register system, with archiving facility etc.
I have created it in a test folder to be extracted to c:\
If you put it else where then you will need to edit the menu.ini

I experience the same invisible buttons in any script employing recursive buttons and I am begining to think it has a 'Context' related issue.
In the attached (OLD) script, rather than pass certain CORE variables lots of times between functions, I opted to keep these variables set Globally for any function to use.
If I keep everything in the same context, as shauns example, I seem to get buttons however if I move the routine to a function, which is my general approach, I don't get buttons even though the information is readable from the global variables. Similarly it looks as if the process of Execute(##) is effectivly changing the context in the same way.
It may be a false trail but it is what occurs to me as things stand.
________
BMW M47



~PROJECT_REGISTER.zip
 Description:
Extract this to root of C: so folder names match MENU.ini otherwise edit MENU.INI accordingly.

Download
 Filename:  ~PROJECT_REGISTER.zip
 Filesize:  11.62 KB
 Downloaded:  1581 Time(s)



Last edited by MACE1 on Fri Feb 18, 2011 5:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jan 29, 2007 2:18 pm    Post subject: Reply with quote

So your saying that if you run my test script, using the latest build - you dont see any buttons ... but they are there - just not visible and if you click where they should be - the event triggers ?

What OS etc are you running ?

Anyone else see this behavior ?
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Jan 29, 2007 5:12 pm    Post subject: Reply with quote

I am not seeing this behavior, it is working as expected on my box.
Think that there is some other underlieing problem.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


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

PostPosted: Wed Jan 31, 2007 9:25 am    Post subject: Hummmm Reply with quote

We are primarily a DELL site, with everyones workstation & laptop on XP pro SP2 with latest patches (Use WSUS)

I have a logon script which deploys among other things KIX updates.
I keep the source folder updated and everyone gets it.
I updated the dll when I had occasion to download and the following AM started receiving calls saying NO BUTTONS. Rolled back the DLL, got everyone to re-logon, problem disappeared.

Started investigation...

Guys if this is a CODING issue we can move the thread to a more apropriate location if desired.

Regarding the original question... What say you all ?
________
Starcraft Ii Replays
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion 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