setText mb $ "Hello World"
qshow mb () -- Segmentation Failt
--print ("Hello world") -- it works
Run Code Online (Sandbox Code Playgroud)
我正在使用qtHaskell,但我发现跟踪示例的唯一问题是qshow分段错误.
也许有人有任何想法我怎么能尝试解决它?
谢谢.
补充:完整的程序代码:
module Main where
import Qtc.Classes.Qccs
import Qtc.Classes.Gui
import Qtc.ClassTypes.Gui
import Qtc.Core.Base
import Qtc.Gui.Base
import Qtc.Gui.QApplication
import Qtc.Gui.QWidget
import Qtc.Gui.QPushButton
import Qtc.Gui.QAbstractButton
import Qtc.Gui.QMessageBox
type MyQPushButton = QPushButtonSc (CMyQPushButton)
data CMyQPushButton = CMyQPushButton
myQPushButton :: String -> IO (MyQPushButton)
myQPushButton b = qSubClass $ qPushButton b
main :: IO Int
main = do
qApplication ()
hello <- myQPushButton "Hello qtHaskell …Run Code Online (Sandbox Code Playgroud) 如何从页面获取窗口,所以我的窗口中有一个页面框架:
<Frame NavigationUIVisibility="Hidden" Name="frmContent" Source="Page/Page1.xaml" OverridesDefaultStyle="False" Margin="0,0,0,0" />
Run Code Online (Sandbox Code Playgroud)
并试图以这种方式从这个页面访问我的窗口:
private void Page_Loaded(object sender, RoutedEventArgs e)
{
if ((Window1)this.Parent == null)
System.Windows.Forms.MessageBox.Show("111");
else
wb1.ObjectForScripting = new MyScriptObject((Window1)this.Parent);
Run Code Online (Sandbox Code Playgroud)
但是Parent返回null,所以我看到"111"消息,
我的错误在哪里以及如何使窗口对象正确?
在代码中:
if ((host = (struct hostent*) gethostbyname(address) ) == 0) // address is a string
Run Code Online (Sandbox Code Playgroud)
在4.5.x gcc上进行交叉编译(通用arm架构)时,我收到了警告:
(.text+0x1558): warning: gethostbyname is obsolescent, use getnameinfo() instead.
Run Code Online (Sandbox Code Playgroud)
int WSAAPI getnameinfo(
__in const struct sockaddr FAR *sa,
__in socklen_t salen,
__out char FAR *host,
__in DWORD hostlen,
__out char FAR *serv,
__in DWORD servlen,
__in int flags
);
Run Code Online (Sandbox Code Playgroud)
它有更多参数......而且我对它感到困惑,我只需要它就像gethostbyname工作一样.传递什么参数以保持简单愚蠢与gethostbyname一样?
最后这是我的尝试:
struct sockaddr_in servAddr;
struct hostent *host; /* Structure containing host information */
/* open socket */
if ((handle = socket(PF_INET, SOCK_STREAM, …Run Code Online (Sandbox Code Playgroud) 在抽象中:
int i = 1;
auto go = [] () {
return i;
};
Run Code Online (Sandbox Code Playgroud)
是否有可能在现代C++语法中做出类似的东西?
我用于#ifdef Win32安全通话,sprintf_s但现在我想用MinGW建立项目,现在它错了.我需要使用#ifdef VC++或以某种方式.可能吗?
当我改变CheckBox的状态时,我很想知道
CheckBox->Checked=false;
Run Code Online (Sandbox Code Playgroud)
它调用CheckBoxOnClick事件,如何避免它?
我总是将emacs作为守护进程运行,但是当我想要做出类似的东西时
sudo emacsclient /etc/make.conf
Run Code Online (Sandbox Code Playgroud)
我不能这样做,因为root正在使用另一个emacs,我真的不想运行2个守护进程或等待通常的emacs加载简单文件.
我需要一些解决方案emacsclientsudo /etc/make.conf:)用用户emacs客户端编辑系统文件.
我想不添加boost.cxx如果cmake find_package发现没有安装boost.find_package是否会返回一些我可以包装的条件来编译boost.cxx.这是我当前的cmake文件:
add_executable (complex complex.cxx lexer.cxx boost.cxx ../../src/lili.cxx ../../src/lilu.cxx)
# Make sure the compiler can find all include files
include_directories (../../src)
include_directories (.)
# Make sure the linker can find all needed libraries
# rt: clock_gettime()
target_link_libraries(complex rt)
# Install example application
install (TARGETS complex
RUNTIME DESTINATION bin)
IF(UNIX)
find_package(Boost COMPONENTS system filesystem REQUIRED)
## Compiler flags
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-O2")
set(CMAKE_EXE_LINKER_FLAGS "-lsqlite3 -lrt -lpthread")
endif()
target_link_libraries(complex
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
#${PROTOBUF_LIBRARY}
)
ENDIF(UNIX)
Run Code Online (Sandbox Code Playgroud) 我真的不喜欢有怪物.git文件夹(2GB),我不关心2002年的变化,我不想创建新的存储库,所以我该怎么做才能清理.git/log?
请注意,我希望它不仅仅是本地的,下次我想要自2011年以来没有历史记录或历史记录克隆存储库.
谢谢
我有一个模块,用于串行端口sygnal的事件
serialPort.DataReceived.AddHandler(SerialDataReceivedEventHandler(DataReceived));
Run Code Online (Sandbox Code Playgroud)
DataReceived的位置
let DataReceived a b =
rxstring <- serialPort.ReadExisting()
arrayRead <- System.Text.Encoding.UTF8.GetBytes(rxstring)
if arrayRead.[0] = 0x0Auy then
ProcessData(a, null)
Run Code Online (Sandbox Code Playgroud)
和ProcessData正在调用WinForms方法
let ProcessData(a, b) =
dataProcessor.Invoke(a, b) |> ignore
Run Code Online (Sandbox Code Playgroud)
是的
private void ProcessData(object sender, EventArgs e) {
byte[] m = Core.ncon.ArrayRead;
switch (m[1]) {
case 0x01: {
if (m.Length > 5) {
int myval = BitConverter.ToInt32(m, 3);
textBox1.Text += " val: " + myval.ToString() + " ";
Run Code Online (Sandbox Code Playgroud)
但是当它试图访问textBox1时我得到了:
跨线程操作无效:控制'textBox1'从其创建的线程以外的线程访问.
所以问题是如何从另一个模块事件中访问WinForm元素?