473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pointer array / slider question

Hi everyone. I am trying to generate a certain number of sliders on my CDialog, that certain number is not fixed. I managed to make the sliders appear by doing this:

for certain length{
CSliderCtrl *tracker = new CSliderCtrl();
tracker->Create(WS_CHILD | WS_VISIBLE,
CRect(left, top, right, bottom), this, i);
}

However when I try to get the results of each slider, it only returns the position of the last slider:

for certain length{
int f = tracker->GetPos();
Change f to fString;
MessageBox(fString);
}

Is the only around this to use arrays? I tried to set up an array of sliders but it's not working. I don't think I understand what I need to do to program it. Any help is appreciated! Thanks.
Apr 1 '08 #1
3 1545
gpraghuram
1,275 Expert 1GB
Hi everyone. I am trying to generate a certain number of sliders on my CDialog, that certain number is not fixed. I managed to make the sliders appear by doing this:

for certain length{
CSliderCtrl *tracker = new CSliderCtrl();
tracker->Create(WS_CHILD | WS_VISIBLE,
CRect(left, top, right, bottom), this, i);
}

However when I try to get the results of each slider, it only returns the position of the last slider:

for certain length{
int f = tracker->GetPos();
Change f to fString;
MessageBox(fString);
}

Is the only around this to use arrays? I tried to set up an array of sliders but it's not working. I don't think I understand what I need to do to program it. Any help is appreciated! Thanks.
You are having a single dimension object and allocating only one object of the size and how you can expect it will maintain all the sliders entry.
As you have told it will return only the last window status.
If you want to have status of multiple sliders then declarethe pointer above the for loop and then allocate the required sliders and then iterate it to access every slider

raghuram
Apr 1 '08 #2
You are having a single dimension object and allocating only one object of the size and how you can expect it will maintain all the sliders entry.
As you have told it will return only the last window status.
If you want to have status of multiple sliders then declarethe pointer above the for loop and then allocate the required sliders and then iterate it to access every slider

raghuram
Thanks you. I have tried to make an array of pointers but it's not working. I'm afraid I don't fully understand how to do that. Can you point me in the right direction? Thanks.
Apr 1 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
Just create an array of pointers:

Expand|Select|Wrap|Line Numbers
  1. CSliderCtrl* ctrls[10];             //10 pointers on stack
  2. CSliderCtrl** ctrls = new CSliderCtrl*[10];   //10 pointers on heap
  3.  



Read this article: http://bytes.com/forum/thread772412.html.
Apr 1 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jason Charalambides | last post by:
I need to assign a slider to determine a percentage value for a certain variable in my program. I decided to use a slider so that the user will be able to manually set a value between 0.000... to...
1
by: paja | last post by:
Hello All In my application I am using TackBar, in past there used to be a controll like Slider. Wtih slider you could graphically show that what section of slider you have selected by fill in...
0
by: monuindia | last post by:
HI, I am new to python graphics. I want to have a scale(tkinter) or slider(wxpython), on which I can have more than one pointers. Using it I want to have single slider for different parameters of...
9
by: sangeetha | last post by:
Hello, Is there any performance difference in using of the following two declaration? int (*ptr); //Array of 10 int pointers int *ptr; // pointer-to-array of 10. Regards, Sangeetha.
11
by: x-pander | last post by:
given the code: <file: c.c> typedef int quad_t; void w0(int *r, const quad_t *p) { *r = (*p); }
28
by: Wonder | last post by:
Hello, I'm confused by the pointer definition such as int *(p); It seems if the parenthesis close p, it defines only 3 integers. The star is just useless. It can be showed by my program: ...
1
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP...
14
by: sheroork | last post by:
Can anyone help me in getting to understand pointer to pointer with examples? Appritiate in advance. Sagar
9
by: subramanian100in | last post by:
The following portion is from c-faq.com - comp.lang.c FAQ list · Question 6.13 int a1 = {0, 1, 2}; int a2 = {{3, 4, 5}, {6, 7, 8}}; int *ip; /* pointer to int */ int (*ap); /* pointer to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.