Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » [SOLVED]Control property syntax (ArrayCtrl, Button), IDE syntax guide unclear to me
[SOLVED]Control property syntax (ArrayCtrl, Button), IDE syntax guide unclear to me [message #44301] Sat, 21 February 2015 03:09 Go to next message
Edward is currently offline  Edward
Messages: 34
Registered: February 2015
Location: United States
Member
This should be simple for a seasoned U++ user.

The full syntax of controls, here is what I have so far:
{
	CtrlLayout(*this, "Window title");
	Sizeable().Zoomable();
	SimpleDemo.arrLIST.AddColumn("Item");
	SimpleDemo.arrLIST.Removing();
	SimpleDemo.btnAdd <<= THISBACK(AddItem);
}


Build Log:
C:\upp\examples\SimpleDemo\main.cpp: In constructor 'SimpleDemo::SimpleDemo()':
C:\upp\examples\SimpleDemo\main.cpp:7:13: error: expected unqualified-id before '.' token
SimpleDemo.arrList.AddColumn("Item");
^
C:\upp\examples\SimpleDemo\main.cpp:8:13: error: expected unqualified-id before '.' token
SimpleDemo.arrList.Removing();
^
C:\upp\examples\SimpleDemo\main.cpp:9:13: error: expected unqualified-id before '.' token
SimpleDemo.btnAdd <<= THISBACK(AddItem);
^
Any advice appreciated.
  • Attachment: Days_log.txt
    (Size: 3.79KB, Downloaded 204 times)


My mission is to find a powerful(Non MS) C++ IDE w/GUI to marry and spend the rest of my life with...

[Updated on: Sat, 21 February 2015 17:50]

Report message to a moderator

Re: Control syntax (ArrayCtrl, Button), & references [message #44303 is a reply to message #44301] Sat, 21 February 2015 09:31 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Edward

Sorry for the question: is SimpleDemo a class name or a variable name?


Best regards
Iñaki
Re: Control syntax (ArrayCtrl, Button), & references [message #44304 is a reply to message #44301] Sat, 21 February 2015 15:37 Go to previous messageGo to next message
Edward is currently offline  Edward
Messages: 34
Registered: February 2015
Location: United States
Member
Excuse the omission of the details.

The project files are: SimpleDemo.h, main.cpp, SimpleDemo.lav

Control names: btnAdd - Button, arrLIST - Array Control (ArrayCtrl), strItem - EditString


My mission is to find a powerful(Non MS) C++ IDE w/GUI to marry and spend the rest of my life with...
Re: Control property syntax (ArrayCtrl, Button), IDE syntax guide unclear to me [message #44305 is a reply to message #44301] Sat, 21 February 2015 17:49 Go to previous messageGo to next message
Edward is currently offline  Edward
Messages: 34
Registered: February 2015
Location: United States
Member
Resolved !!!! Resolved !!!! Resolved !!!!

This solves the build errors found in this example project.
http:// www.codeproject.com/Articles/15163/Getting-Started-With-Ulti mate?msg=5005237

This is a great simple exercise for a newbie planning to work with data forms.
File: main.cpp
#include "SimpleDemo.h"

SimpleDemo::SimpleDemo()
{
	CtrlLayout(*this, "Window title");
	Sizeable().Zoomable();
	arrLIST.AddColumn(t_("Item"));  // **** Corrected !! ****
	arrLIST.Removing();
  	btnAdd <<= THISBACK(AddItem);  // Uses a callback to link the button to the function
	
}

void SimpleDemo::AddItem()
{
    // The ~ operator calls the object's GetData() function
    arrLIST.Add(~strItem);
    strItem <<= Null;        // Manually clear the item
}

GUI_APP_MAIN
{
	SimpleDemo().Run();
}




My mission is to find a powerful(Non MS) C++ IDE w/GUI to marry and spend the rest of my life with...

[Updated on: Sat, 21 February 2015 18:02]

Report message to a moderator

Re: Control syntax (ArrayCtrl, Button), & references [message #44307 is a reply to message #44304] Sat, 21 February 2015 17:56 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Edward,

When you derived from layout or you declare variable in your class you don't need to use operator ".". This construction is strange. Where have you declared variable "SimpleDemo"?

So,
SimpleDemo::SimpleDemo()
{
	CtrlLayout(*this, "Window title");
	Sizeable().Zoomable();
	SimpleDemo.arrLIST.AddColumn("Item"); // <- Illegal construction in c++. Write "arrLIST.AddColumn("Item");" insted.
	SimpleDemo.arrLIST.Removing(); // <- Do the same
	SimpleDemo.btnAdd <<= THISBACK(AddItem); // <- Do the same
}


If you want to explicitly refer to the derived class variables you can do something like this (But this construction is rare used):
WithSimplyDemoLayout::arrLIST.doSomething();
// In this case this is equals to:
arrLIST.doSomething();


To get current class element you can use "*this" syntax (rare used in c++).
this->myInt = 5;


Sincerely,
Klugier


U++ - one framework to rule them all.
Re: [SOLVED]Control property syntax (ArrayCtrl, Button), IDE syntax guide unclear to me [message #44308 is a reply to message #44301] Sat, 21 February 2015 18:07 Go to previous messageGo to next message
Edward is currently offline  Edward
Messages: 34
Registered: February 2015
Location: United States
Member
klugier

SimpleDemo is the project name.
I think your answer is line 1 of main.cpp.
The build error log messages were a bit misleading (to Me), considering the simple fix required to resolve the errors.

Take a look at the fixed project (SimpleDemo5) attached above.


My mission is to find a powerful(Non MS) C++ IDE w/GUI to marry and spend the rest of my life with...

[Updated on: Sat, 21 February 2015 18:09]

Report message to a moderator

Re: [SOLVED]Control property syntax (ArrayCtrl, Button), IDE syntax guide unclear to me [message #44312 is a reply to message #44308] Sat, 21 February 2015 21:24 Go to previous message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Edward,

I will change one thing in your code. You shouldn't use "using namespace Upp" in your header file (.h). Use "NAMESPACE_UPP" & "END_UPP_NAMESPACE" construction. In implementation file (.cpp) you can/should use "using namespace Upp" or "NAMESPACE_UPP" construction.

This is recommendation for all Upp projects.

P.S. 1
This construction is implemented in my previous post.

P.S. 2
Why you shouldn't use "using namespace" in header file - http://stackoverflow.com/questions/5849457/using-namespace-i n-c-headers.

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Sat, 21 February 2015 21:33]

Report message to a moderator

Previous Topic: Errors during compiling the examples
Next Topic: [SOLVED]Deleted layout controls still cause errors in compile. How? 8183 MinGW
Goto Forum:
  


Current Time: Fri Mar 29 10:39:12 CET 2024

Total time taken to generate the page: 0.01843 seconds