| Poster | Thread |
Yogi27
|  |
Help with Itext in intuition? Posted on 28-Jul-2010 22:53:51
| | [ #1 ] |
|
|
 |
Regular Member  |
Joined: 11-Dec-2002 Posts: 358
From: Chicago, Illinois | | |
|
| Hi Everyone!
I am trying to get used to coding in OS 4 style as opposed to the classic style of programming in C. Unfortunately there is not alot of examples for os 4 or a book for that matter.
I am having trouble with bit of code:
struct IntuiText MyText;
MyText.LeftEdge = 10; MyText.TopEdge = 20; MyText.IText = "This is an example text in a window"; MyText.DrawMode = JAM1; MyText.FrontPen = 1; MyText.NextText = NULL;
IIntuition->PrintIText( MyWindow->RPort, &MyText, 0, 0 );
The trouble I am having is in the MyText.Itext = "This is an example text in a window" line.
The compiler is saying warning: deprecated conversion from string constant to 'char*'
Can anyone help me fix this. Does OS 4 have a better way to print text in a window.
Thanks
Yogi |
|
| Status: Offline |
|
|
Trixie
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 5:50:29
| | [ #2 ] |
|
|
 |
Amiga Developer Team  |
Joined: 1-Sep-2003 Posts: 2119
From: Czech Republic | | |
|
| @Yogi27
What do you need the text for? What purpose does it serve in your window? Apart from that I can tell you that PrintIText() is almost never used these days. Tell me what you are trying to do and I can help you find an appropriate solution. Last edited by Trixie on 29-Jul-2010 at 05:52 AM.
_________________ The Rear Window blog
AmigaOne X5000/020 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition |
|
| Status: Offline |
|
|
tboeckel
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 6:58:12
| | [ #3 ] |
|
|
 |
Regular Member  |
Joined: 7-Oct-2004 Posts: 274
From: Rehmerloh, Germany | | |
|
| @Yogi27
Use the corresponding functions of graphics.library: SetAPen(),SetBPen(),SetDrMd() or SetABPenDrMd() Move() Text() _________________ Why stop it now, just when I am hating it?
Thore Böckelmann |
|
| Status: Offline |
|
|
vidarh
 |  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 8:36:08
| | [ #4 ] |
|
|
 |
Cult Member  |
Joined: 4-Jan-2010 Posts: 580
From: London, UK (ex-pat; originally from Norway) | | |
|
| @Yogi27
Quote:
The trouble I am having is in the MyText.Itext = "This is an example text in a window" line.
The compiler is saying warning: deprecated conversion from string constant to 'char*'
|
The problem here is the header is using "obsolete" C. The compiler can and will assume that a string constant effectively has the "const" qualifier.
Apart from the other recommendations of avoiding PrintIText() - I have no idea of the merit of those recommendations - you can do one of:
* Ignoring the warning. It's harmless (as long as you don't pass the string constant to some function that actually tries to modify it). * Try changing the line to MyText.Itext = (char *)"This is an example text in a window".
_________________ Wiki for new/returning Amiga users - Projects: ACE basic compiler / FrexxEd / Git |
|
| Status: Offline |
|
|
salass00
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 9:19:54
| | [ #5 ] |
|
|
 |
Elite Member  |
Joined: 31-Oct-2003 Posts: 2707
From: Finland | | |
|
| @Yogi27
The warning is because the IText field in the IntuiText is defined as STRPTR instead of CONST_STRPTR in "intuition/intuition.h". To get around it simply use a cast when assigning to it:
MyText.IText = (STRPTR)"This is an example text in a window"; |
|
| Status: Offline |
|
|
Yogi27
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 11:39:13
| | [ #6 ] |
|
|
 |
Regular Member  |
Joined: 11-Dec-2002 Posts: 358
From: Chicago, Illinois | | |
|
| @Trixie
I am just learning how to program using the Amiga APIs again. I just wrote a simple program that opens a window and prints some text in it.
Since things have changed so much from back in the day, for example, I see to open a window you should use window tags instead of the old NewWindow.LeftEdge for example.
I will check out the graphics library for printing text and thanks to everyone for the help.
Yogi |
|
| Status: Offline |
|
|
centaurz
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 12:18:14
| | [ #7 ] |
|
|
 |
Member  |
Joined: 16-Feb-2006 Posts: 65
From: France | | |
|
| @Yogi27
Quote:
Since things have changed so much from back in the day, for example, I see to open a window you should use window tags instead of the old NewWindow.LeftEdge for example.
|
Errr... since Kickstart V36, so early 90's I would say .Last edited by centaurz on 29-Jul-2010 at 12:18 PM.
|
|
| Status: Offline |
|
|
Trixie
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 12:51:00
| | [ #8 ] |
|
|
 |
Amiga Developer Team  |
Joined: 1-Sep-2003 Posts: 2119
From: Czech Republic | | |
|
| @Yogi27
Quote:
| Since things have changed so much from back in the day, for example, I see to open a window you should use window tags instead of the old NewWindow.LeftEdge for example. |
Do not waste your time with obsolete concepts! There have been significant changes in user interface programming, which roughly boil down to the following:
- Most Amiga GUI components (windows, requesters, gadgets, images) are now programmed in an object-oriented way, using the ReAction/BOOPSI toolkit. - Every such component is created as an object, not as a pointer to a system structure. That means no more filling structures with data. - Objects are manipulated using methods and by passing tags via the SetAttrs() function.
Frankly, you have something to learn. A good introduction to the BOOPSI system is the Amiga ROM Kernel Reference Manual: Libraries, Chapter 12, "BOOPSI - Object-oriented Intuition". For some insight into how GUIs are programmed using ReAction, download this guide._________________ The Rear Window blog
AmigaOne X5000/020 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition |
|
| Status: Offline |
|
|
Heinz
|  |
Re: Help with Itext in intuition? Posted on 29-Jul-2010 20:36:34
| | [ #9 ] |
|
|
 |
Regular Member  |
Joined: 10-Oct-2005 Posts: 212
From: Unknown | | |
|
| @Yogi27
If you want to code for OS4 only, then Reaction is the way to go. If you want to make protable code, that can be compiled for AmigaOS3.x, MorphOS and AROS too, then you should take a look at MUI.
Thats another GUI Toolkit, that is very popular. On AROS its called ZUNE, but its the same API. |
|
| Status: Offline |
|
|