|
Hans,
It happens when I drag the resize bar on any columns. For example, if I expand the 12th column, it pushes the rest of the columns to the right of the view.
In window explorer, the horizontal scrollbar on the bottom would adjust dynamically so I can see the all the columns to the right of the 12th column.
In my list view, the scrollbar doesn't adjust at all, so column 13, 14, and 15 get pushed out of the list view.
I have these styles setup for the listctrl:
LVS_REPORT | LVS_SINGLESEL | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES |LVS_EX_SUBITEMIMAGES
I hope I'm explaining a little bit more clear this time. Thank you very much for replying.
|
|
|
|
|
Without seeing your code, I would guess that you're not setting the columns correctly when you initialize the listctrl. In particular, look at the column widths you specify.
|
|
|
|
|
I probably did or didn't do something which caused the scrollbar to stop working in my listview.
I wrote the following workaround in OnHdnItemchanged and it sort of fixed the problem except that
if I push the last column all the way passes the right edge of my listview, the scrollbar thumb track
does not adjust or the view does not expand to include the last column.
int iTotalWidth=0;
for(int i=0; i < 16; i++)
{
int iWidth = GetListCtrl().GetColumnWidth(i);
iTotalWidth += iWidth;
}
GetListCtrl().SetScrollRange(SB_HORZ, 0, iTotalWidth,0);
Invalidate();
If anyone has any idea, please help!
Thanks!!
|
|
|
|
|
I have declared a variable
CADORecordset* m_Rpipe; in class
CPipeLineView
I call a method
bool DetectSeque(int pipeID) in class
CPipeLineView
In function
bool CPipeLineView::DetectSeque(int pipeID )
like follows
<br />
bool CPipeLineView::DetectSeque(int pipeID)<br />
{<br />
m_Rpipe=CPipeDAL::GetPipeByID(pipeID);
<br />
m_Rpipe->->MoveFirst();<br />
<br />
bool flag=false;<br />
<br />
<br />
<br />
<br />
while(!m_Rpipe->IsEOF()&&!m_Rpipe->IsBof())<br />
{<br />
<br />
if()
{<br />
.....<br />
}<br />
m_Rpipe->MoveNext();<br />
}<br />
return flag;<br />
}<br />
<br /> ,
as what is list above, errors accur while running at
m_Rpipe->MoveNext() .But when I put
m_Rpipe->MoveNext();
before
if sentence,it runs normally!
Please lend me a hand!
|
|
|
|
|
what errors do you get?
Additionally, I don't think you've pasted that code correctly - the second MoveNext() is out of the while loop and superfluous
How many rows are you expecting to fetch in this rowset?
|
|
|
|
|
I am sorry to make such a mistake.m_Rpipe->MoveNext() is in while loop
A dialog box pops up,which says "First-change exception in PipeLine.exe(KERNEL32.DLL):0xE06D7363:Mircosoft C++ Exception".
Thanks in advance.Do me a favor.
|
|
|
|
|
We need to know what exception you're getting ...
I would *guess* that the problem exists in your if(...) clause, and it seems to work when you put the MoveNext before it, because you're getting the second row of your rowset, which doesn't fulfill your if(...) test
Just guessing mind, there's not an awful lot to go on there
|
|
|
|
|
I just want to scan all objects in recordset m_Rpipe while it fulfills certain condition.
There are no questions in if clause.
|
|
|
|
|
you need to run this under the debugger to find out what's going wrong
|
|
|
|
|
Ok,I'll debug carefully to find out the errors.Thank you again.
|
|
|
|
|
Process A launches process B with re-directed out, and err.
Process B must write to the console only - no re-direction (as the output will obviously be routed back to Process A).
I have tried a number of ways; including _cputs() etc. But I need a method where the output is rendered faithfully - where extended ASCII chars are written correctly. None of the 'console only' output functions seem to support this.
Any suggestions? Third party libraries I might look at?
Thanks in advance.
|
|
|
|
|
|
Hi Hans.
Thank you for the suggestion but all of the variations of printf, cout etc .. all write to an (re-directable) output stream. I need to write the console only.
|
|
|
|
|
You might try CreateFile() with device name "CON" and dwDesiredAccess = GENERIC_WRITE.
|
|
|
|
|
Thanks Hans ..
I am going to try that!
Cheers.
|
|
|
|
|
Hans.
Thanks a lot for the CreateFile() suggestion. It works perfectly .. I am delighted. You should create a short post about CONS only output. There is lots out there about re-direction etc .. but nothing that I could find about faithful rendering of console only output. Again .. cheers.
Best regards.
James.
|
|
|
|
|
Thanks for letting me know.
For my own curiosity, can you say why you want to disallow redirection?
|
|
|
|
|
Hi Hans.
I have been writing an application for a few years now .. www.tenfiftytwo.co.uk/pipelines
It's basically a multi-stream pipelines (textual manipulation) app that will allow you to chain together pipelines to transform text/data.
I am developing a TRACE option that allows interactive user input to inspect i/o records and in order to do this each called process must share the same console. So, console prompts must be just that - no redirection back to the calling process. They need to be console only. Only the called process output should be captured by re-directed streams.
Best regards.
James.
PS. Cannot believe that I did not think of CreateFile() .. thanks again.
|
|
|
|
|
Hi!
I've to parse an XML File using Tiny XML. My XML file contents are:
<?xml version="1.0"?>
<request>
<properties name ="TicketID">T5jkbec7i2f410m</properties>
<Form1Buttons>Login,Reset,Exit</Form1Buttons>
</request>
I've to pass "TicketID" and get the result as "T5jkbec7i2f410m". Also I've to pass "Form1Buttons" and get "Login,Reset,Exit" as result.
I've used the following code:
const char* common::Parse_XML_Document(char* filename, char* tagname)
{
TiXmlDocument * tiDoc = new TiXmlDocument(filename);
TiXmlElement * tiElement = new TiXmlElement(tagname);
const char * value = new char[1024];
if(tiDoc->LoadFile())
{
value = tiElement->GetText();
}
return value;
}
But value contains only a BadPtr. How to pass the XML file name and the tag name and retrieve the value of that tag?
|
|
|
|
|
Did you try to check out TineXML's Documentation[^] yet? They even have some tutorials[^], maybe those can help you?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
pix_programmer wrote: I've to parse an XML File using Tiny XML. My XML file contents are
Certainly looks like a bad way to use xml.
pix_programmer wrote: I've to pass "TicketID"
The value 'TicketID' is not an element. Instead you have an element named 'properties' which has an attribute called 'name' whose value is 'TicketID'.
pix_programmer wrote: How to pass the XML file name and the tag name and retrieve the value of that
tag?
Your code is not even logically correct. Any program must be logically correct to work.
As two examples
- you assign an array to 'value' and then immediately assign another value to it. (As a default value it might be correct but in terms of C++ it is uninitialized and probably has lifetime problems.)
- there is no relationship between tiDoc and tiElement, so there is no way the latter can ever get a value from the former.
|
|
|
|
|
Hey everybody,
I just want to know what you think of a Huffman coding implemented using two queues and a cursor instead of using a binary tree or a priority. Please feel free to post your thoughts about it or what can be done to improve its performance. Basically, the algorithm has two queues as arguments where it first reads the first one (which has to be sorted BTW),and then creates the second queue by adding the values of the two lowest nodes in the first queue. The cursors serve as pointers of each nodes in the second queue to its left and right children in the first one (it can also be reference to the previous nodes in the second one). I think with the whole process, the algorithm has an O(n) number of operations but you be the critic.
void generateHuffman(Queue& q1, Queue& q2)
{
QueueNode *leftChild, *rightChild, *tempNode;
q1.enqueue(q1.dequeue());
q2.enqueue(q1.front()+q1.back());
rightChild = q1.backNode();
q1.enqueue(q1.dequeue());
leftChild = q1.backNode();
q2.setCursor(leftChild, rightChild);
while (q1.back() <= q1.front())
{
q2.enqueue( q1.front()+q2.front() );
tempNode = q2.backNode();
q2.enqueue(q2.dequeue());
tempNode->rightCursor = q2.backNode();
q1.enqueue(q1.dequeue());
tempNode->leftCursor = q1.backNode();
while( q2.frontNode() != tempNode)
q2.enqueue(q2.dequeue());
tempNode = NULL;
}
}
#include "QueueException.h"
typedef int QueueItemType;
struct QueueNode
{
QueueItemType item;
QueueNode *leftCursor;
QueueNode *rightCursor;
QueueNode *next;
};
class Queue
{
public:
Queue();
~Queue();
bool isEmpty() const;
QueueItemType front() const throw(QueueException);
QueueItemType back() const throw(QueueException);
QueueItemType dequeue() throw(QueueException);
QueueNode *frontNode() const throw(QueueException);
QueueNode *backNode() const throw(QueueException);
void dequeue(QueueItemType& queueFront) throw(QueueException);
void enqueue(const QueueItemType& newItem) throw(QueueException);
void setCursor(QueueNode *l, QueueNode *r) throw(QueueException);
private:
QueueNode *backPtr;
QueueNode *frontPtr;
};
Hope this helps to give me some advice. Thanks
|
|
|
|
|
So what's your question/problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Actually, I have a lot of problems when dealing with this algorithm that I made.
One is that I'm not sure if this is the right way to implement Huffman coding using two queues and cursors.
Second is that this won't work unless the first queue is sorted, and I have no clue on how to sort this using an STL sort function or any other way.
Third is that the values that each node will get shall come from an array that lists all the frequency of characters in an input file. What I have right now is an array of 256 components (for all ASCIIs) that stores these frequencies in the file. I can print them out with their designated characters, but the problem comes when I try sort the array at this point which only gives me a sorted array of values (or frequencies) that have new designated characters based on their positions after the sort.
I have my source files running so far. Do you want me to post them also here?
|
|
|
|
|
Francis Paran wrote: Second is that this won't work unless the first queue is sorted, and I have no
clue on how to sort this using an STL sort function or any other way.
Using a queue from the STL, you can sort like:
bool comparater( const int& p1, const int& p2 )
{
return p1 < p2;
}
std::deque<int> q;
std::sort(q.begin(), q.end(), comparater);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|