Thanks to all, it works now. I'm only using it only for buttons, so it is a good solution.
uffe --- In [email protected], "Roger C. Morgan II" <[EMAIL PROTECTED]> wrote: > If this function is only used with button captions, pass the button as > the parameter and dereference the Caption property inside the > function. The button object will automatically be passed by reference > so the caption should change without any trouble. > > Roger C. Morgan II > [EMAIL PROTECTED] > > --- In [email protected], "safeldt2" <[EMAIL PROTECTED]> wrote: > > It is a OnScreenKeyboard for a touch screen. I need to send the new > > value back to the calling procedure. The default value when the > > keybords shows is the old content of caption. On exit the new value > > should be send back to the caption. > > > > > > function TfmKeyboard.keyboard(KeybString: string; CaptionString: > > string):string; > > begin > > Caption := CaptionString; //Caption on keyboard form > > edEnterValue.text := KeybString; > > showmodal; > > if ModalResult = mrOk then > > Keyboard := edEnterValue.text > > else > > Keyboard := KeybString; > > end; > > > > Right now I made it work with af function, but it irretates me to > > write the same variable twice. I'm going to use this keyboard for > > several projekts. > > > > > > btOperator.Caption := //Caption on button. > > fmKeyboard.keyboard(btOperator.Caption, 'Enter operator no'); > > > > Uffe > > > > > > > > > > > > --- In [email protected], Vahan Yoghoudjian <[EMAIL PROTECTED]> > wrote: > > > if you really dont need to pass the parameter as variable, > > declare it > > > as constant > > > TfmKeyboard.keyboard(const aCaption: TCaption); > > > > > > Vahan > > > > > > > > > > > > > > > -----Original Message----- > > > From: [email protected] [mailto:delphi > [EMAIL PROTECTED] > > Behalf > > > Of safeldt2 > > > Sent: Friday, September 09, 2005 12:31 PM > > > To: [email protected] > > > Subject: [delphi-en] Re: Passing a caption as var string. > > > > > > > > > --- In [email protected], Vahan Yoghoudjian <[EMAIL PROTECTED]> > wrote: > > > > Button.Caption is of Type TCaption, either declare your > > > parameter is TCaption... > > > > > > I tried that but then I get this error: > > > > > > "Constant object cannot be passed as var parameter" > > > > > > Why is it a constant when I can give it a new value at runtime? > > > btCompound.Caption := 'a text'; > > > > > > > > > The main problem is that i need to call the procedure many times > in my > > > project and found it more ellegant not to use temporary variables. > > > > > > Uffe > > > > > > > > > > > > > > > > > > ----------------------------------------------------- > > > Home page: http://groups.yahoo.com/group/delphi-en/ > > > To unsubscribe: [EMAIL PROTECTED] > > > > > > > > > > > > > > > -------------------------------------------------- > -------------------------- > > > ---- > > > YAHOO! GROUPS LINKS > > > > > > a.. Visit your group "delphi-en" on the web. > > > > > > b.. To unsubscribe from this group, send an email to: > > > [EMAIL PROTECTED] > > > > > > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > Service. > > > > > > > > > > > > -------------------------------------------------- > -------------------------- > > > ---- > > > > > > > > > > > > > > > > > > [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/i7folB/TM --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

