XIDE Painter and Tabcontrols

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

XIDE Painter and Tabcontrols

Post by Karl-Heinz »

Hi Chris,

it seems that each time XIDE generates the class and the constructor, the code for the pages is not created.

in my sample there are 3 pages:

oTPTABCONTROL1_PAGE1
oTPTABCONTROL1_PAGE2
oTPTABCONTROL1_PAGE3

when i add the missing code manually all works as expected again. Before i dive in deeper, are there any known issues when tabcontrols are involved ?

regards
Karl-Heinz

Code: Select all


--------------------------------------
---------- VO - created code  --------
--------------------------------------

CLASS Tab INHERIT DATAWINDOW 

	PROTECT oDCTabControl1 AS TABCONTROL
	PROTECT oTPTABCONTROL1_PAGE1 AS TABCONTROL1_PAGE1
	PROTECT oTPTABCONTROL1_PAGE2 AS TABCONTROL1_PAGE2
	PROTECT oTPTABCONTROL1_PAGE3 AS TABCONTROL1_PAGE3

  //{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)

----------------------------------------------------------------

METHOD Init(oWindow,iCtlID,oServer,uExtra) CLASS Tab 

SELF:PreInit(oWindow,iCtlID,oServer,uExtra)

SUPER:Init(oWindow,ResourceID{"Tab",_GetInst()},iCtlID)

oDCTabControl1 := TabControl{SELF,ResourceID{TAB_TABCONTROL1,_GetInst()}}
oDCTabControl1:HyperLabel := HyperLabel{#TabControl1,NULL_STRING,NULL_STRING,NULL_STRING}

SELF:Caption := "DataWindow Caption"
SELF:HyperLabel := HyperLabel{#Tab,"DataWindow Caption",NULL_STRING,NULL_STRING}

IF !IsNil(oServer)
	SELF:Use(oServer)
ENDIF
oTPTABCONTROL1_PAGE1 := TABCONTROL1_PAGE1{SELF, 0}
oDCTabControl1:AppendTab(#TABCONTROL1_PAGE1,"Page",oTPTABCONTROL1_PAGE1,0)
oTPTABCONTROL1_PAGE2 := TABCONTROL1_PAGE2{SELF, 0}
oDCTabControl1:AppendTab(#TABCONTROL1_PAGE2,"Page",oTPTABCONTROL1_PAGE2,0)
oTPTABCONTROL1_PAGE3 := TABCONTROL1_PAGE3{SELF, 0}
oDCTabControl1:AppendTab(#TABCONTROL1_PAGE3,"Page",oTPTABCONTROL1_PAGE3,0)
oDCTabControl1:SelectTab(#TABCONTROL1_PAGE1)

SELF:PostInit(oWindow,iCtlID,oServer,uExtra)

RETURN SELF

------------------------------------------------------------
------------  XIDE generated code after Painter changes ----

As you see the code for the 3 Pages is missing

-------------------------------------------------------------

PARTIAL CLASS Tab INHERIT DATAWINDOW
PROTECT oDCTabControl1 AS TABCONTROL

// User code starts here (DO NOT remove this line)  ##USER##

------------------------------------------

CONSTRUCTOR(oWindow,iCtlID,oServer,uExtra)

	SELF:PreInit(oWindow,iCtlID,oServer,uExtra)

	SUPER(oWindow , ResourceID{"Tab" , _GetInst()},iCtlID)

	SELF:oDCTabControl1 := TABCONTROL{SELF , ResourceID{ TAB_TABCONTROL1  , _GetInst() } }
	SELF:oDCTabControl1:HyperLabel := HyperLabel{#TabControl1 , NULL_STRING , NULL_STRING , NULL_STRING}

	SELF:Caption := "DataWindow Caption"
	SELF:HyperLabel := HyperLabel{#Tab , "DataWindow Caption" , NULL_STRING , NULL_STRING}
	IF !IsNil(oServer)
		SELF:Use(oServer)
	ENDIF



	SELF:PostInit(oWindow,iCtlID,oServer,uExtra)

RETURN


User avatar
Chris
Posts: 4900
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XIDE Painter and Tabcontrols

Post by Chris »

Hi Karl-Heinz,

Yes, it should work, but I think I know what happened, it's because the name of the caption of the pages is "Page", change them to Page1, Page2 etc or something else and it will work! :)

That was a quick and dirty trick I used, in order to tell if the page is actually created by the user, or is just the default page that the editor shows when you create a new TabControl. Apparently not the smartest solution, will improve this, thanks :)

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

XIDE Painter and Tabcontrols

Post by Karl-Heinz »

Hi Chris,

yes, each page has the caption name "Page", but

1. When i change the content of the "Page Caption" to anything other than "Page" and leave the content field an InvalidCastException is thrown

Code: Select all

System.InvalidCastException: Die angegebene Umwandlung ist ungültig.
   bei Xide.VOWindowEditor.ApplyProperty(DesignItem _oDesign, DesignProperty _oProp)
   bei Xide.VOWindowEditor.PropertyGotUpdated(DesignItem oDesign, DesignProperty oProp)
   bei Xide.VOWindowEditor.DoBasicAction(DesignerBasicAction oAction, DesignerBasicActionType eAction, ActionData uData)
   bei Xide.DesignerBase.StartAction(DesignerBasicActionType eAction, ActionData uData)
   bei Xide.VOWindowEditor.PropertyModifiedInGrid(String cProp, Object oValue)
   bei Xide.PropertyPanel.SetProperty(Object oValue)
   bei Xide.PropertyTextBox.OnLostFocus(EventArgs e)
   bei System.Windows.Forms.Control.WmKillFocus(Message& m)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.TextBoxBase.WndProc(Message& m)
   bei System.Windows.Forms.TextBox.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2. The same error is thrown - with the same text as above - when i want to change the "Page Name" content.

3. The same error is thrown when i click on the "Page Data Aware" content, but the stacklist is different.

Code: Select all

System.InvalidCastException: Die angegebene Umwandlung ist ungültig.
   bei Xide.PropertyPanel.ShowControl()
   bei Xide.PropertyPanel.OnMouseDown(MouseEventArgs e)
   bei System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
let me know if you need the complete errorlists.


regards
Karl-Heinz
User avatar
Chris
Posts: 4900
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XIDE Painter and Tabcontrols

Post by Chris »

Hi Karl-Heinz,

Oops, yeah, I can easily reproduce it! Very serious problem, thanks for reporting, will fix this ASAP.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

XIDE Painter and Tabcontrols

Post by Karl-Heinz »

Hi Chris,

Thanks.

With the new files it´s working now, and when i rename the pages they become visible.

That´s the way it should always be:

- you have a problem
- you go to bed
- when you wake up it´s gone ;-)

But a small problem is left. The "Page Data Aware" combobox shows the value ( "0" or "1" ) instead of the textvalue ( "Yes" or "No" ) . Honestly spoken, i never changed/needed this setting in VO, but is it correct that "0" means "Yes" and "1" "No" ?

regards
Karl-Heinz
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XIDE Painter and Tabcontrols

Post by wriedmann »

Hi Karl-Heinz (and Chris of course!),
- you have a problem
- you go to bed
- when you wake up it´s gone
As Robert said in our Italian meeting: Chris is giving a incredible support.

I can only confirm that.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4900
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XIDE Painter and Tabcontrols

Post by Chris »

Guys,

Heh, thanks for the nice words :). When we can, we always try to provide quick fixes, it's been like that since the vulcan days. Unfortunately not all problems are so easy to fix or easy to distribute quickfixes for them though.

About the 0/1 in the property, I also noticed it, not sure why it appears like that, will investigate it. For now, it's "0" for the first of the possible values ("Yes") and "1" for the second ("No"), this is dictated by cavowed.inf. But from what I see (testing in VO), that property makes no difference at all in the generated code/resource, it only affects the generation of the tabpage window itself, when you create it from scratch, if it's gonna be a DataWindow or DialogWindow. Which feature is not implemented yet, for now you need to create the tabpage window (for new pages) manually anyway :)

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply