Change a label dynamically

tompynation
Member Posts: 398
Hi,
Is it possible to change a label his Caption in the OnAfterGetRecord method?
And could we make a textbox invisible, or disabled? Also in the OnAfterGetRecord...
Thx
Is it possible to change a label his Caption in the OnAfterGetRecord method?
And could we make a textbox invisible, or disabled? Also in the OnAfterGetRecord...
Thx
0
Answers
-
If you explain in more detail what you want to do then we can help more.
http://savatage99.googlepages.com/ButtonThingy.JPG
http://savatage99.googlepages.com/ButtonThingy2.JPG
**Edit Added Button Thingy examples**0 -
in a form possible, but not in a report.
What you want to do :?:
RegardsDo you make it right, it works too!0 -
The easiest way to simulate a dynamic caption change of a label is to use a textbox control on card forms. The Editable, Focusable and Border properties of the textbox should be set to No. But this is not applicable in list forms. You must apply following to change the caption of a label.
To change the caption of a label, use the following technics:
1. Set the CaptionClass property to a variable or a constant
2. Modify CaptionClassTranslate function of the codeunit 1 so as to process the assigned value of the captionclass.
3. If you used a variable for the captionclass property, change the value of the variable in code dynamically, but don't forget to call CurrForm.UPDATE and CurrForm.UPDATECONTROLS functions.
Here is a short example of what I did:
1. I added following code fragment to the CaptionClassTranslate functionEXIT(CaptionExpr);
2. I declared a text(80) variable in a list form, say myVariable. And I set CaptionClass property of a textbox in the tablebox to myVariable.
3. I added two buttons with following code in their OnPush() triggersmyVariable := 'VALUE1'; //and 'VALUE2' for the other button CurrForm.UPDATE; CurrForm.UPDATECONTROLS;
When I clicked first button, the caption of the textbox (which is shown as a column in the tablebox) set to 'VALUE1'; and when I clicked the other button it set to 'VALUE2'.
You can change your algorithm in the CaptionClassTranslate function as you wish.
Don't forget to close Navision before testing the development because Codeunit 1 is a static codeunit and its initial compiled code, which loaded at the start, will persist unless you quit Navision.Cem Karaer @ Pargesoft
Dynamics NAV Developer since 20050 -
I've set caption class property of Label to VELD1
Then in CodeUnit1 i added following code to the CaptionClassTranslate function:
CASE Language OF
2067 :
CASE CaptionExpr OF
'VELD1' : EXIT('Veld1');
'VELD2' : EXIT('Veld2');
END;
But the text 'Veld1' is not displaying as my label caption ??
Am i missing something? It's NAV 5.0 SP10 -
I tried the other option with a variable as well, but it isnt working neither...
I've changed captionclass to a global variable = gv_Text2
Then in the OnOpenForm i added this code:
gv_Text2 := 'Testje';
CurrForm.UPDATE;
CurrForm.UPDATECONTROLS;
But nothing happens ](*,)
When i add the EXIT(CaptionExpr); as first line in the CaptionClassTranslate method of CodeUnit 1
I get a messagebox popping up when i open the item card asking me if i am sure that i want to rename a record ??0 -
It does work, but i had to add the Caption class inside the Table
not on the form \:D/0 -
Do not put EXIT(CaptionExpr) at the start of the CaptionClassTranslate function, which will ruin all VAT and dimension related captionclass processing!Cem Karaer @ Pargesoft
Dynamics NAV Developer since 20050 -
I'm a time-traveller from the year 2018. Me and my colleague are working on this strange artifact called NAV 2009 R2 Classic Client. We were trying to dynamically alter a list form's captions.
We modified the CaptionClass property which worked on initial load, but were stumped after CurrForm.UPDATE(FALSE) didn't update the captions to the form's current state. However, CurrForm.UPDATECONTROLS did the trick!
Thank you @Cem_Karaeraka Vincent Vancalbergh
"I tried filtering life, but the universe returned an Internal Error"0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions