473,385 Members | 1,925 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,385 software developers and data experts.

I need a toggle button so when a key is pressed it starts then stops when the key is

I need this to start when PageUp is pressed then stop when PageUp is pressed again. or only start when PgUp is held down then when the key isn't pressed, it stops


static int uiStartCb(Ihandle *ih) {
char buf[MSG_BUFSIZE];
UNREFERENCED_PARAMETER(ih);
if (divertStart(IupGetAttribute(filterText, "VALUE"), buf) == 0) {
showStatus(buf);
return IUP_DEFAULT;
}

// successfully started
showStatus("Started filtering. Enable functionalities to take effect. L");
IupSetAttribute(filterText, "ACTIVE", "NO");
IupSetAttribute(filterButton, "TITLE", "Stop");
IupSetCallback(filterButton, "ACTION", uiStopCb);
IupSetAttribute(timer, "RUN", "YES");
}
return IUP_DEFAULT;
}

static int uiStopCb(Ihandle *ih) {
int ix;
UNREFERENCED_PARAMETER(ih);

// try stopping
IupSetAttribute(filterButton, "ACTIVE", "NO");
IupFlush(); // flush to show disabled state
divertStop();

IupSetAttribute(filterText, "ACTIVE", "YES");
IupSetAttribute(filterButton, "TITLE", "Start");
IupSetAttribute(filterButton, "ACTIVE", "YES");
IupSetCallback(filterButton, "ACTION", uiStartCb);

// stop timer and clean up icons
IupSetAttribute(timer, "RUN", "NO");
for (ix = 0; ix < MODULE_CNT; ++ix) {
modules[ix]->processTriggered = 0; // use = here since is threads already stopped
IupSetAttribute(modules[ix]->iconHandle, "IMAGE", "none_icon");
}
sendState = SEND_STATUS_NONE;
IupSetAttribute(stateIcon, "IMAGE", "none_icon");

showStatus("Stopped. To begin again, edit criteria and click Start.");
return IUP_DEFAULT;
}

static int uiToggleControls(Ihandle *ih, int state) {
Ihandle *controls = (Ihandle*)IupGetAttribute(ih, CONTROLS_HANDLE);
short *target = (short*)IupGetAttribute(ih, SYNCED_VALUE);
int controlsActive = IupGetInt(controls, "ACTIVE");
if (controlsActive && !state) {
IupSetAttribute(controls, "ACTIVE", "NO");
InterlockedExchange16(target, I2S(state));
} else if (!controlsActive && state) {
IupSetAttribute(controls, "ACTIVE", "YES");
InterlockedExchange16(target, I2S(state));
}
Apr 12 '17 #1
0 1046

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

Similar topics

4
by: Targa | last post by:
I have a form in which I want to have an button(image) displayed next to a checkbox when it is checked. If the box is unchecked, the button should disappear. How can I do this? Thanks!
3
by: James McGivney | last post by:
I have a project in VS.NET using C# I have a series of buttons on an aspx page. When one of the buttons is pressed, a panel becomes visible and allows the user to enter and edit data. I want to...
1
by: MattB | last post by:
I want to have a "finalize sale" button that disables it's self immediately when pressed (so they can't hit it twice). I thought putting mybutton.enabled=false in the click event would do it, but I...
2
by: Mel | last post by:
Hi, is there any way I can implement toolstrip toggle button simular to the MS Word alignment button? if one toggle button already pressed down, if user click on the "pushed down button", the...
19
by: darrel | last post by:
On my vb.net page, I have 4 sets of inputs + form buttons. example: Search: (GO) Zip: (GO) County: (GO) County: (GO) The problem is if I go to the page, type in a zip code, and hit...
5
JustJim
by: JustJim | last post by:
Hi All I have a little application I'm working on for the local Department of Education. There is a "Main Menu" form that has a toggle button on it to show/hide the Database Window. When it is...
1
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I...
3
by: noddy | last post by:
I have a button <input type="button" value="Get data"> When it is clicked a database is accessed and the data is eventually displayed on the screen. While the data is being retrieved the...
8
by: Jeff Ciaccio | last post by:
I would like to create a toggle button, so I chose a radio and set its apperance to button. Is seems my method always makes this .checked = false. Can somebody help me to see the error in my ways?...
3
by: Saser | last post by:
Hi all bytes out there. I have a few little problems in my program. The program is supposed to help me to not spend too much time of my day at the computer ;) I play a game called...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.