error text format

This forum is meant for questions and discussions about the X# language and tools
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

error text format

Post by robert »

Karl,
This depends on what you choose to display the error.
If you use the built in ErrorDialog() function then the message with 2 tabs look ugly.
There is no way we can format this so that it looks Ok in all circumstances...
I personally think that the MessageBox that you are using is not the best way to display the error...
Maybe we should add a method / function that returns a 2 dimensional array with descriptions and values, so you can format it yourself.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

error text format

Post by Karl-Heinz »

Hi Robert,

yes, it´s currently only a MsgBox. But i see the tab problems when i use a painted window and write the e:ToString() content to a mle- or txtControl instead. The idea to retrieve a 2 dim array instead sounds interesting. Then it would be e.g. possible to avoid tabs and simply add two txt controls to a form. The error descriptions go to the left and the error values to the right control.

But first of all, I´ll take a look at the possibility to split the current e:ToString() content.

regards
Karl-Heinz
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

error text format

Post by Karl-Heinz »

Hi Robert,

i´ve looked at the ErrorDialog sources and added the possibility to position a tab. Because it doesn´t make much sence to pass an array of INTs i´m using a single INT only. i think the marshalling is ok.

Code: Select all

PUBLIC METHOD SetTabStop ( i AS INT ) AS LOGIC  
LOCAL tabPosPointer AS IntPtr
LOCAL lOk AS LOGIC 
		
    tabPosPointer := Marshal.AllocHGlobal( 1 * Marshal.SizeOf(typeof(INT)))		
        
    // NOTE: zero based !
    Marshal.WriteInt32( tabPosPointer, 0 * Marshal.SizeOf(typeof(INT)), i )
 
    lOk := ( Sendmessage ( SELF:ErrorText:Handle , EM_SETTABSTOPS , 1  ,  tabPosPointer )  == 1 ) 	 
	
    Marshal.FreeHGlobal(tabPosPointer)	
  
    RETURN  lOk

END METHOD 


Now the TextBox content might even look like in the attachment :-)

regards
Karl-Heinz
Attachments
ErrDialog.jpg
ErrDialog.jpg (39.12 KiB) Viewed 189 times
Post Reply