Page 1 of 1 1
Topic Options
#172713 - 2007-01-12 10:11 AM How to Change button TEXT !
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
This extract is a modifier to the well known grouped button UDF where it endevours to change the text on the specified buttons, namely button1 of each group of buttons. The Function enumerates correctly but I can not get the button text to change. I have guessed the ###.text is what I need to change but have no reference to check what components are required.
Code:
; Button1 Loop Modifier
  Function MainBtns
  $button_array = 10,20
  $boxcntr = 1
  $box = READPROFILESTRING(@scriptdir + $ini,"BOX" + $boxcntr,"BUTTON1")
  WHILE $box <>""
   REDIM $button_array[0]
   $button_array = SPLIT($cmd,";")
   $tmpvar = "BUTTON1"
   $BLANK = "~~~~~~"
   If $CPRCSV = $PRCSV
    $ = EXECUTE("$+$$cmdBOX$BOXCNT$TMPVAR.TEXT = $$BUTTON_ARRAY[0]")
   Else
    $ = EXECUTE("$+$$cmdBOX$BOXCNT$TMPVAR.TEXT = $$BLANK")
   Endif
  $boxcntr = $boxcntr+1
  $box = READPROFILESTRING(@scriptdir + $ini,"BOX" + $boxcntr,"BUTTON1")
  Loop
  EndFunction

1] Is the ###.text the component that is required and if not what is ?
2] Where can I find a reference to the different components supported.

I am using Kix release - 4.53

Top
#172715 - 2007-01-12 12:19 PM Re: How to Change button TEXT ! [Re: MACE]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
.text is no component.
it's the property of the button object.

how you wanna set it?

in this code it sets the text to corresponding element of $button_array which is from:
$button_array = SPLIT($cmd,";")

you can define whatever inside $cmd or create your own $button_array so you don't need to change the UDF at all.

anyway, this UDF is poorly constructed as it uses global vars and is a PITA to control inside larger script.
_________________________
!

download KiXnet

Top
#172717 - 2007-01-12 01:15 PM Re: How to Change button TEXT ! [Re: MACE]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Originally Posted By: MACE
well known grouped button UDF


Who? What? Where? Eh?
_________________________



Top
#172720 - 2007-01-12 02:01 PM Re: How to Change button TEXT ! [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I bet it's part of KFD or at least some other similar proggie...
_________________________
!

download KiXnet

Top
#172721 - 2007-01-12 02:18 PM Re: How to Change button TEXT ! [Re: Lonkero]
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
I agree it was not the easirest of ways to do things, it was done 2 years ago and is used extensivly so dont wish to start again. I need to put this function in so as to remove /change text on existing buttons.
As shown it works fine - that is if I am applying the changes to the right place. IS THE ###.TEXT THE RIGHT PLACE TO CHANGE THAT BUTTONS TEXT OR IS IT SOME OTHER ###.???.
The function works I just am not sure where to identify the components available within each button type etc....


Edited by MACE (2007-01-12 02:19 PM)

Top
#172722 - 2007-01-12 02:39 PM Re: How to Change button TEXT ! [Re: MACE]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
what is $cmd set to equal, this will contain the values that you are looking for?
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172723 - 2007-01-12 02:44 PM Re: How to Change button TEXT ! [Re: Benny69]
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
FORGET the workings of the function...
The correct values to be applied are there it is just when I apply them to ###.text the button does not change and I dont know why therefore is it ###.text where the button text is specified ?

Top
#172725 - 2007-01-12 03:16 PM Re: How to Change button TEXT ! [Re: MACE]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
You have to reference the specific button within your button array. So to set / change the text on the button ...

Code:
$Change = $Button_Array[1,1]
$Change.text = "New Text"


there may be a way that I am not aware of to work with the multi dimensional array directly, but I have never been able to get it to work.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172729 - 2007-01-12 04:25 PM Re: How to Change button TEXT ! [Re: Gargoyle]
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
The thing is, even if I ignore the primary routine above and hard code each button, the text does not update on the buttons.
Works ok for Note box, but not Button... and on the same form.
Do I have to close and re-open the form ? It is the master loop so would require a re-write.

Top
#172730 - 2007-01-12 05:08 PM Re: How to Change button TEXT ! [Re: MACE]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
If you want us to better help you, you should post the entire code. Other wise all we can do is guess.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172731 - 2007-01-12 05:31 PM Re: How to Change button TEXT ! [Re: Benny69]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... if not the entire code, a working snippet to show the problem.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#172739 - 2007-01-12 08:39 PM Re: How to Change button TEXT ! [Re: MACE]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well if this code is from 2 years ago then my guess is that the KIXFORMS.DLL is also that old and just MAY NOT support what you're trying to do either.

Please confirm the version of KiXforms.

Is it KiXforms CLASSIC or KiXforms.NET ? What is the version ?


.

Top
#172786 - 2007-01-15 01:02 PM Re: How to Change button TEXT ! [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
button text was changeable from the start.
_________________________
!

download KiXnet

Top
#173061 - 2007-01-22 06:08 PM Re: How to Change button TEXT ! [Re: Benny69]
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
I gave up trying to modify the text and simply used ###.hide to achieve the same end.

I am using KIX 4.53 per original post.

If you forget the function as listed and look at the following, this is why I find it particularly annoying...

$myvariable = $thisbutton.text works
$thisbutton.text = $myvariable does not error but button remains unchanged.

Should I force a ###.refresh ?

If anyone has any idea for future, leave it here.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.113 seconds in which 0.072 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org