New topic: 

TextArea - Cocoa vs Carbon [Solved.... well Explained]

<http://forums.realsoftware.com/viewtopic.php?t=47726>

         Page 1 of 1
   [ 13 posts ]                 Previous topic | Next topic          Author  
Message        DaveS          Post subject: TextArea - Cocoa vs Carbon 
[Solved.... well Explained]Posted: Sun Apr 28, 2013 11:28 am                    
             
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                Could someone take a look at this 
project and see if they can tell me if the problem is something I did (or 
didn't do) or if it is a remaining bug in Cocoa implementation?

This is a sample project stripped down to the minimum required to duplicate the 
problem.

Basically it is a simple StyledText window that accepts text from an outside 
control, allows the user to edit it, and then puts it back

The final version has a toolbar for BOLD/ITALIC/COLOR etc... and when that 
toolbar is there.... COCOA won't even let the user type anything... 
Removing that toolbar at least allows the textarea to accept text... but the 
ability to change Font/Size are ignored.

here is a link to a zip file http://www.rdsisemore.com/ta_test.rbp.zip

there is a note section explaining expected behaviour, and what happens in 
Carbon vs Cocoa....

I would REALLY appreciate it someone had the time to download this (its not a 
ton of code).... and compile both as CARBON and COCOA and see if they can find 
the issue.

I REALLY REALLY need this work in COCOA.   The ironic thing is that this 
control is one of the less complex parts of the overall project, and everything 
else works perfectly in COCOA      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind      

    Last edited by DaveS on Sun Apr 28, 2013 5:19 pm, edited 1 time in total.   
                             Top                Axel-Erfurt          Post 
subject: Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 12:15 pm        
                 
Joined: Fri Nov 16, 2012 8:10 pm
Posts: 31                Cocoa (10.8.3)

I think the problem is Update_FontInfo Method

I can not write into winTextBar Window
if I close the window the app crashes

when I put a comment in this code, I can write in winTextBar.

'fnt=TextArea1.SelTextFont
'fnt=ConvertEncoding(fnt,encodings.ascii)
'fnt=ReplaceAll(fnt,Chr(0),"")
'If Len(fnt)=0 Then fnt="Arial"
'x=-1
'For i=0 To puFONT.ListCount-1
's=puFONT.list(i)
'If Left(fnt,Len(s))=s Then x=i
'Next i
'If x>=0 And x<>puFONT.listindex Then puFONT.listindex=x
'//
'// Update FontSize Listbox
'//
'x=TextArea1.SelTextSize
'For i=0 To puFONT.ListCount-1
'If Val(puSIZE.list(i))=x Then
'puSIZE.ListIndex=i
'Exit For
'End If
'Next i
'busy=False
   
                             Top                DaveS          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 12:19 pm                 
                
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                yes.... I know that.....  
the question is WHY?  

If you had read the notes section it explained all of that already..... this 
works fine under Cocoa.... and that code you commented is the "issue"      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                cm_rb          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 1:24 pm                  
       
Joined: Sat Dec 24, 2011 5:32 am
Posts: 40
Location: Germany                Hello,
nothing seems to get executed after this line:

fnt=TextArea1.SelTextFont   
                             Top                DaveS          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 1:37 pm                  
               
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                Not to complain about people trying to 
help.... but please... read my notes. 
I know WHAT does not work, 
I know WHERE it does not work.... 
what I don't know is WHY it doesn't work in Cocoa...

Is there something *I* need to do different as a work-around because of Cocoa?
Does it plain NOT work, but will (maybe) work when XoJo is released?

So... do I
a) wait for Xojo... and continue with other aspects of my project until then?
b) recode using a work-around that someone may or may not be able to suggest?
c) scrap this window and try a whole different approach?      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                me.self          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 4:01 pm                  
       
Joined: Wed May 25, 2011 10:18 am
Posts: 19                I would do a).
The TextArea is very buggy at this time. I stopped using it. If Xojo uses it, 
they must have fixed a lot of bugs. I *guess* the Code Editor is based on 
TextArea...

Kind regards
Christian      
_________________
me.self works with:
Real Studio Pro (always the latest), 10.7.x, Mac mini i5, Love  
                             Top                cm_rb          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 4:03 pm                  
       
Joined: Sat Dec 24, 2011 5:32 am
Posts: 40
Location: Germany                Cocoa-Build

Hello,
in the Change-events of „puFont“ and „puSize“ you are having the code:

If ready And Not busy Then
  ...
End If


but both (ready and busy) are TRUE when changing the selection in the popupmenu 
so nothing will happen.


In the Method „Update_FontInfo“ should it not be

For i=0 To puSize.ListCount-1
  If Val(puSIZE.list(i))=x Then
  puSIZE.ListIndex=i
  Exit For
  End If
Next i


instead of

 For i=0 To puFONT.ListCount-1
  If Val(puSIZE.list(i))=x Then
  puSIZE.ListIndex=i
  Exit For
  End If
Next i
   
                             Top                DaveS          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 5:00 pm                  
               
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                1)  Busy should ONLY be TRUE if  those 
events are called DURING the UPDATE_FONTINFO procedure... which they will be as 
that procedure changes there value.  Otherwise there would be an infinite 
loop.. With the puFONT and/or puSIZE CHANGE event calling UPDATE_FONTINFO, and 
UPDATE_FONTINFO changing the value ... ad nauseum.  The BUSY flag is set to 
TRUE at the beginning of UPDATE_FONTINFO, to hold off events from the popup 
menus, and set to FALSE as the last step. And READY is set to true to hold off 
random events while the window initializes.

So the CHANGE event will only do something 
IF the window is initialized (READY=TRUE) and UPDATE_FONTINFO is not active 
(BUSY=FALSE).
Both flags should be TRUE only for the split second that UPDATE_INFO is running


2) Yes it should be puSIZE not puFONT..... but in reality it should still work 
as there are more fonts than sizes.... and would always exit when it found the 
right index value.


Anyone out there in the XOJO beta that can just tell me if it works there or 
not?     
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                DaveS          Post subject: 
Re: TextArea - Cocoa vs CarbonPosted: Sun Apr 28, 2013 5:08 pm                  
               
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                However... a previous post did point at 
something that I didn't fully appreciate.


the line

fnt=TextArea1.SelTextFont

in COCOA when it hits that line..... IT EXITS THE PROCEDURE without completing 
it!
It doesn't bomb... no errors... it just exits.... leaving BUSY still set to 
TRUE!      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                DaveS          Post subject: 
Re: TextArea - Cocoa vs Carbon [Solved.... well Explained]Posted: Sun Apr 28, 
2013 5:22 pm                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                Ok... after lots of frustration... and 
testing..... and hair pulling (which at my age I can't afford)

Carbon. SelTextFont/SelTextSize will return the values related to the nearest 
character if the cursor is in the text, but a range of characters is not 
selected.  (SELLENGTH=0 is allowed)

Cocoa.  Will NOT. It must have a SELLENGTH>=1 or it does really strange things

SOOOOoo.... I am going to see if I can code it to detect that... actually 
select a character... get the data.. .and reset SELENGTH before returning.....  
    
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                JShaffer          Post subject: 
Re: TextArea - Cocoa vs Carbon [Solved.... well Explained]Posted: Sun Apr 28, 
2013 5:40 pm                         
Joined: Fri Jan 23, 2009 9:18 am
Posts: 104
Location: Summerfield, Florida                I believe feedback 15839 
describes the problems you are seeing.

Multiple problems with text area have a status of fixed and verified.

Jim   
                             Top                DaveS          Post subject: 
Re: TextArea - Cocoa vs Carbon [Solved.... well Explained]Posted: Sun Apr 28, 
2013 5:44 pm                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4807
Location: San Diego, CA                Thanks... too bad I have NEVER been able 
to figure out how to get the feedback system to work....      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                languer          Post subject: 
Re: TextArea - Cocoa vs Carbon [Solved.... well Explained]Posted: Sun Apr 28, 
2013 7:58 pm                         
Joined: Wed Feb 16, 2011 1:59 pm
Posts: 66
Location: Arizona, USA                So without directly helping you and by 
re-stating some of the obvious; other people did help you. Not bad. This is 
where having someone completely unbiased review one's code and errors pays 
dividend.      
_________________
Windows XP SP3
RS 2012r2  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 13 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to